Corrected while() documentation (#400)
* Corrected while() args Added `expr` to the args of while() in the documentation * Corrected while() args Added `expr` to the args of while() in the documentation * Update docs/scarpet/language/LoopsAndHigherOrderFunctions.md Co-authored-by: James103 <37945304+James103@users.noreply.github.com> Co-authored-by: James103 <37945304+James103@users.noreply.github.com>
This commit is contained in:
1 parent
0a0503fb08
commit
a322752549
2 files changed
+3
-3
No files matched your search
@@ -1109,7 +1109,7 @@ for(range(1000000,1100000),check_prime(_)) => 7216
|
|||||||
|
|
||||||
From which we can learn that there is 7216 primes between 1M and 1.1M
|
From which we can learn that there is 7216 primes between 1M and 1.1M
|
||||||
|
|
||||||
### `while(cond, limit)`
|
### `while(cond, limit,expr)`
|
||||||
|
|
||||||
Evaluates expression `expr` repeatedly until condition `cond` becomes false, but not more than `limit` times.
|
Evaluates expression `expr` repeatedly until condition `cond` becomes false, but not more than `limit` times.
|
||||||
Returns the result of the last `expr` evaluation, or `null` if nothing was successful. Both `expr` and `cond` will
|
Returns the result of the last `expr` evaluation, or `null` if nothing was successful. Both `expr` and `cond` will
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ for(range(1000000,1100000),check_prime(_)) => 7216
|
|||||||
|
|
||||||
From which we can learn that there is 7216 primes between 1M and 1.1M
|
From which we can learn that there is 7216 primes between 1M and 1.1M
|
||||||
|
|
||||||
### `while(cond, limit)`
|
### `while(cond, limit, expr)`
|
||||||
|
|
||||||
Evaluates expression `expr` repeatedly until condition `cond` becomes false, but not more than `limit` times.
|
Evaluates expression `expr` repeatedly until condition `cond` becomes false, but not more than `limit` times.
|
||||||
Returns the result of the last `expr` evaluation, or `null` if nothing was successful. Both `expr` and `cond` will
|
Returns the result of the last `expr` evaluation, or `null` if nothing was successful. Both `expr` and `cond` will
|
||||||
@@ -145,4 +145,4 @@ it will be used from now on as a new value for the accumulator.
|
|||||||
<pre>
|
<pre>
|
||||||
reduce([1,2,3,4],_a+_,0) => 10
|
reduce([1,2,3,4],_a+_,0) => 10
|
||||||
reduce([1,2,3,4],_a*_,1) => 24
|
reduce([1,2,3,4],_a*_,1) => 24
|
||||||
</pre>
|
</pre>
|
||||||
Reference in new issue
Block a user