Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Loops-Nested/Arturo/loops-nested.arturo
Normal file
24
Task/Loops-Nested/Arturo/loops-nested.arturo
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
printTable: function [tbl][
|
||||
; wrapping the nested loop in a function
|
||||
; allows us to use return to exit all of the loops
|
||||
; since `break` only exits the inner loop
|
||||
loop 0..dec size tbl 'x [
|
||||
loop 0..dec size tbl\[x] 'y [
|
||||
prints pad to :string tbl\[x]\[y] 2
|
||||
if tbl\[x]\[y] = 20 -> return ø
|
||||
prints ", "
|
||||
]
|
||||
print ""
|
||||
]
|
||||
]
|
||||
|
||||
a: []
|
||||
loop 1..10 'x [
|
||||
row: []
|
||||
loop 1..10 'y [
|
||||
'row ++ random 1 20
|
||||
]
|
||||
'a ++ @[row]
|
||||
]
|
||||
|
||||
printTable a
|
||||
Loading…
Add table
Add a link
Reference in a new issue