Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
INTERCAL
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Control structures === INTERCAL statements all start with a "statement identifier"; in INTERCAL-72, this can be <code>DO</code>, <code>PLEASE</code>, or <code>PLEASE DO</code>, all of which mean the same to the program (but using one of these too heavily causes the program to be rejected, an [[undocumented feature]] in INTERCAL-72 that was mentioned in the C-INTERCAL manual),<ref name="manualick"/> or an inverted form (with <code>NOT</code> or <code>N'T</code> appended to the identifier).<ref name="manual72"/> Backtracking INTERCAL, a modern variant, also allows variants using <code>MAYBE</code> (possibly combined with PLEASE or DO) as a statement identifier, which introduces a choice-point.<ref name="backtrack">{{cite web|url=http://www.cse.unsw.edu.au/~malcolmr/intercal/backtracking.html |title=Backtracking in Intercal |publisher=Cse.unsw.edu.au |date=2006-04-11 |access-date=2012-03-10}}</ref> Before the identifier, an optional line number (an integer enclosed in parentheses) can be given; after the identifier, a percent chance of the line executing can be given in the format <code>%50</code>, which defaults to 100%.<ref name="manual72"/> In INTERCAL-72, the main control structures are NEXT, RESUME, and FORGET. <code>DO (''line'') NEXT</code> branches to the line specified, remembering the next line that would be executed if it weren't for the NEXT on a call stack (other identifiers than DO can be used on any statement, DO is given as an example); <code>DO FORGET ''expression''</code> removes ''expression'' entries from the top of the call stack (this is useful to avoid the error that otherwise happens when there are more than 80 entries), and <code>DO RESUME ''expression''</code> removes ''expression'' entries from the call stack and jumps to the last line remembered.<ref name="manual72"/> C-INTERCAL also provides the [[COME FROM]] instruction, written <code>DO COME FROM (''line'')</code>; CLC-INTERCAL and the most recent C-INTERCAL versions also provide computed COME FROM (<code>DO COME FROM ''expression'')</code> and NEXT FROM, which is like COME FROM but also saves a return address on the NEXT STACK.<ref name="clc"/> Alternative ways to affect program flow, originally available in INTERCAL-72, are to use the IGNORE and REMEMBER instructions on variables (which cause writes to the variable to be silently ignored and to take effect again, so that instructions can be disabled by causing them to have no effect), and the ABSTAIN and REINSTATE instructions on lines or on types of statement, causing the lines to have no effect or to have an effect again respectively.<ref name="manual72"/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
INTERCAL
(section)
Add topic