Loops/Continue: Difference between revisions
→{{header|Smalltalk}}
(Jakt) |
Ttmrichter (talk | contribs) |
||
Line 2,289:
<syntaxhighlight lang="smalltalk">valueWithExit
^ self value:[^ nil]</syntaxhighlight>
=={{header|SNOBOL4}}==
SNOBOL4 has no looping statements or conditional statements. Indeed the only branching facilities it has are:
* Unconditional branch to label. <code>:(LABEL)</code>
* Branch to label on success. <code>:S(LABEL)</code>
* Branch to label on failure. <code>:F(LABEL)</code>
(The success/failure labels can both be in the branching clause.)
Despite this, any looping structure can be performed by careful use of these.
<syntaxhighlight lang="snobol4">
line =
i = 1
LOOP le(i, 10) :F(LOOP.END)
line = line i
eq(remdr(i, 5), 0) :S(LOOP.OUT)
line = line ', ' :(LOOP.INC)
LOOP.OUT OUTPUT = line
line =
LOOP.INC i = i + 1 :(LOOP)
LOOP.END OUTPUT = line
END
</syntaxhighlight>
{{Out}}
<pre>
$ snobol4 junk.sno
1, 2, 3, 4, 5
6, 7, 8, 9, 10
</pre>
=={{header|Spin}}==
|