Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
INTERCAL
(section)
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"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)