4 ms·
Interesting to see another language that uses the `loop` keyword for C-based `for` loops. The only other I know of is Raku[0]. loop(my $i; $i < 10; $i) {
by luuuzeta 4y ago
Interesting to see another language that uses the `loop` keyword for C-based `for` loops. The only other I know of is Raku[0].
loop(my $i; $i < 10; $i) {
say $i
}
loop {
# do something infinitely
}
[0]: https://docs.raku.org/syntax/loop https://docs.raku.org/syntax/loop
- manbart 4y agoNetRexx uses it too https://www.netrexx.org/Tutorial/nr_9.html https://www.netrexx.org/Tutorial/nr_9.html
- akritid 4y agoAda https://www.adaic.org/learn/materials/intro/part4/ https://www.adaic.org/learn/materials/intro/part4/
- ferrozz_gg 4y ago
- arturo-lang 4y agoWell, why not?! Since, after all, we all know them as "loops" ;-)
- draegtun 4y agoArturo was influenced by Rebol which comes with LOOP - http://www.rebol.com/r3/docs/functions/loop.html http://www.rebol.com/r3/docs/functions/loop.html However there are some differences... loop 10 [ print "hello" ;; prints "hello" 10 times ] repeat n 10 [ print n ;; prints 1 to 10 ] forever [ print "hello" ;; print "hello" forever! ]
- arturo-lang 4y agoArturo has indeed been influenced by Rebol (and many other languages, to be honest). As for looping... loop 1..10 'x -> print x ; prints 1 to 10 loop.with:'i ["one" "two"] 'x -> print [i "=>" x] ; 0 => one, 1 => two do.times: 10 -> print "hello" ; print "hello" 10 times loop.forever 1..10 'x -> print x ; prints 1 to 10, forever loop 1..10 [x y]-> print [x y] ; print 0 1, 2 3, 4 5,... The same works for pretty much every function in the Iterators module: map, select, filter, etc :) https://arturo-lang.io/documentation/library/iterators/ https://arturo-lang.io/documentation/library/iterators/