Switch out l() syntax to [] in docs (#851)
* Switch out l() syntax to [] in docs * Using map syntactic sugar as well. Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
This commit is contained in:
1 parent
451b35b6c5
commit
a343c5d9f2
10 files changed
+59
-60
No files matched your search
@@ -67,7 +67,7 @@ Evaluates expression `expr`, `num` number of times. code>expr receives `_` syste
|
||||
|
||||
<pre>
|
||||
loop(5, game_tick()) => repeat tick 5 times
|
||||
list = l(); loop(5, x = _; loop(5, list += l(x, _) ) ); list
|
||||
list = []; loop(5, x = _; loop(5, list += [x, _] ) ); list
|
||||
// double loop, produces: [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], ... , [4, 2], [4, 3], [4, 4]]
|
||||
</pre>
|
||||
|
||||
@@ -75,7 +75,7 @@ In this small example we will search for first 10 primes, apparently including 0
|
||||
|
||||
<pre>
|
||||
check_prime(n) -> !first( range(2, sqrt(n)+1), !(n % _) );
|
||||
primes = l();
|
||||
primes = [];
|
||||
loop(10000, if(check_prime(_), primes += _ ; if (length(primes) >= 10, break())));
|
||||
primes
|
||||
// outputs: [0, 1, 2, 3, 5, 7, 11, 13, 17, 19]
|
||||
|
||||
Reference in new issue
Block a user