Next: , Previous: , Up: Syntax   [Index]


5.2 Line Labels

INTERCAL-72 C-INTERCAL CLC-INTERCAL J-INTERCAL
yes all versions all versions all versions

The first part of an INTERCAL statement is a line label that specifies what its line number is. This is optional; it’s legal to have a statement without a line number, although that prevents other commands referring to it by number. Line numbers must be constants, and unique within the program. However, they do not have to be in order; unlike some other languages with line numbers, a line with a higher number can come earlier in the program than a line with a lower number, and the numbers don’t affect the order in which commands are executed.

A line label is a integer expressed in decimal within a wax/wane pair (( and )). For instance, this is a valid line label:

(1000)

Note that line numbers from 1000 to 1999 are used by the system library, so using them within your own programs may produce unexpected errors if the system library is included. Apart from this, line numbers from 1 to 65535 are allowed.

It has become reasonably customary for people writing INTERCAL libraries to pick a range of 1000 line numbers (for instance, 3000 to 3999) and stick to that range for all line numbers used in the program (apart from when calling the system library), so if you want to write an INTERCAL library, it may be a good idea to look at the existing libraries (in the pit/lib directory in the C-INTERCAL distribution) and choose a range of numbers that nobody else has used. If you aren’t writing a library, it may be a good idea to avoid such number ranges (that is, use only line numbers below 1000 or very high numbers that are unlikely to be used by libraries in the future), so that you can easily add libraries to your program without renumbering in the future.


Next: , Previous: , Up: Syntax   [Index]