loop

loop through collection, using given iterator and block


Parameters

loop collection :integer :string :dictionary :object :inline :block :range
     params :null :literal :block
     action :block :bytecode

Attributes

with:literaluse given index
forevercycle through collection infinitely

Returns

  • :nothing

Examples

copy
loop [1 2 3] 'x [ print x ] ; 1 ; 2 ; 3

copy
loop 1..3 [x][ print ["x =>" x] ] ; x => 1 ; x => 2 ; x => 3

copy
loop [A a B b C c] [x y][ print [x "=>" y] ] ; A => a ; B => b ; C => c

copy
user: #[ name: "John" surname: "Doe" ] loop user [k v][ print [k "=>" v] ] ; name => John ; surname => Doe

copy
loop.with:'i ["zero" "one" "two"] 'x [ print ["item at:" i "=>" x] ] ; 0 => zero ; 1 => one ; 2 => two

copy
loop.forever [1 2 3] => print ; 1 2 3 1 2 3 1 2 3 ...

Related