Anonymous user
Jump anywhere: Difference between revisions
→{{header|COBOL}}: fixed syntax highlighting
(Added Tiny BASIC) |
imported>Acediast (→{{header|COBOL}}: fixed syntax highlighting) |
||
Line 911:
=={{header|COBOL}}==
<syntaxhighlight lang="
PROGRAM-ID.
* Nobody writes like this, of course; but...
PROCEDURE DIVISION.
* You can jump anywhere you like.
start-paragraph.
GO TO
yet-another-paragraph.
ALTER
* That's right, folks: we don't just have GO TOs, we have GO TOs whose
* destinations can be changed at will, from anywhere in the program,
* at run time.
GO TO
* But bear in mind: once you get there, the GO TO no longer goes to
* where it says it goes to.
a-paragraph-somewhere.
DISPLAY 'Never heard of him.'
STOP RUN.
some-other-paragraph.
* You think that's bad? You ain't seen nothing.
GO TO
an-arbitrary-paragraph.
DISPLAY 'Edsger who now?'
GO TO some-other-paragraph.
END PROGRAM jumps-program.</syntaxhighlight>
{{out}}
<pre>Edsger who now?
Line 941 ⟶ 949:
'''COBOL''' also supports computed go to phrases, given a list of labels (paragraph names) and an integer index into that list.
<syntaxhighlight lang="
WORKING-STORAGE SECTION.
GO TO quebec, ontario, manitoba DEPENDING ON province</syntaxhighlight>▼
01 province PICTURE IS 99 VALUE IS 2.
PROCEDURE DIVISION.
* Jumps to section or paragraph named 'ontario'.</syntaxhighlight>
=={{header|Common Lisp}}==
|