Jump anywhere: Difference between revisions

→‎{{header|SNOBOL4}}: Made the labels clearer for figuring out how this works.
(→‎{{header|SNOBOL4}}: Made the labels clearer for figuring out how this works.)
Line 2,866:
<syntaxhighlight lang="snobol4">
* Demonstrate an unconditional branch.
OUTPUT = "Unconditional branch." :(SKIP1.START)
OUTPUT = "This will not display."
 
* Demonstrate a branch on success.
SKIP1 .START v = 1
SKIP1.ALOOP gt(v, 5) :S(SKIP2.START)
OUTPUT = "Iteration A" v
v = v + 1 :(SKIP1.ALOOP)
 
* Demonstrate a branch on failure.
SKIP2 .START v = 1
SKIP2.ALOOP le(v, 5) :F(SKIP3.START)
OUTPUT = "Iteration B" v
v = v + 1 :(SKIP2.ALOOP)
 
* Demonstrate a combined branch.
* Demonstrate also an indirect branch.
SKIP3 .START v = 0
label = "SKIP3.ALOOP"
SKIP3.ALOOP v = v + 1
le(v, 5) :S(SKIP3.BPRINT)F(EXIT)
SKIP3.BPRINT OUTPUT = "Iteration C" v :($label)
 
EXIT OUTPUT = "Goodbye"
34

edits