Free Format |
Top Previous Next |
In the examples shown so far, a certain formatting has been implied. Statements, for instance, have been written one to a line. XPL0 is a free-format language, which means that the compiler ignores formatting characters such as spaces, tabs, carriage returns, and form feeds. These characters are only used to make the structure of the program more apparent to the reader.
The example program shown above could be rewritten as follows without changing the way it compiles or runs:
code ChOut=8, CrLf=9,IntOut=11,Text=12;integer Counter; define Tab = $09; begin Counter := $41; repeat ChOut ( 0,Counter);ChOut(0,Tab);IntOut( 0
,Counter ) ; CrLf(0);Counter := Counter + 1 until Counter =^G;Text(0,"That's all folks!" );CrLf(0 ) end
However this hides the structure, making it more difficult to see what the program does.
Formatting characters can be left out, but they cannot be used everywhere. Just as with normal English, words cannot be split apart. For example, this causes a compile error:
Count er:=$41; |