Loops/Foreach: Difference between revisions
Content added Content deleted
(Add lang example) |
|||
Line 2,507: | Line 2,507: | ||
next |
next |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|RPL}}== |
|||
In RPL, « printing » a collection means sending it to the printer, if you have one. To just output the items of a list, you put them into the stack, like this: |
|||
≪ { "one" "two" "three" "four" "five" } LIST→ DROP ≫ |
|||
If the idea is to do more than displaying the items, the usual way is a <code>FOR..NEXT</code> loop |
|||
≪ { "one" "two" "three" "four" "five" } → collection |
|||
≪ 1 collection SIZE '''FOR''' j |
|||
collection j GET |
|||
'''NEXT''' |
|||
≫ ≫ |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |