Flow-control structures: Difference between revisions
Content added Content deleted
(→{{header|Wren}}: Updated to version 0.4.0.) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 14: | Line 14: | ||
* [[Iteration|Loop Structures]] |
* [[Iteration|Loop Structures]] |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Python}} |
|||
===Loops=== |
|||
11l supports ''L.break'' and ''L.continue'' to exit from a loop early or short circuit the rest of a loop's body and "continue" on to the next loop iteration. |
|||
<lang 11l>V n = 10 |
|||
Int result |
|||
L(i) 0 .< n |
|||
I (n % 2) == 0 |
|||
L.continue |
|||
I (n % i) == 0 |
|||
result = i |
|||
L.break |
|||
L.was_no_break |
|||
result = -1 |
|||
print(‘No odd factors found’)</lang> |
|||
In addition, as shown in the foregoing example, 11l loops support an ''L.was_no_break'' suite which can be used to handle cases when the loop was intended to search for something, where the code would break out of the loop upon finding its target. |
|||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |