Escape sequences
If you want to tell ioL to actually print a new line, you need to use </n> to represent a newline character. If you want to force ioL to add in an extra space character, you'll need to use </ >.
These are examples of escape sequences in ioL. An escape sequence is a way sneak in characters that would normally be interpreted in a special way, by writing them in a way that does not trigger their usual behaviour.
In ioL, escape sequnces always begin with </ and end with a closing >.
Other characters that can't be printed directly as part of text (as they have special meaning in ioL) include the following:
< > { }
Certain other characters are fine to print as part of text, but may need to be escaped within other ioL code constructs, depending on the context.
= @ # [ ]
Here is the set of escape sequences supported by ioL:
Sequence | Meaning |
---|---|
</ > | A forced single space |
</n> | New line |
</p> | New paragraph |
</t> | Wide space (tab) |
</<> | The < symbol itself |
</>> | The > symbol itself |
<//> | The / symbol itself |
</{> | Left brace { |
</}> | Right brace } |
</=> | Equals sign = |
</@> | 'at' sign @ |
</#> | hash sign # |
</[> | Left bracket [ |
</]> | Right bracket ] |
</#...> | (Replace ... with any numerical character code.) |
The final entry in the table is a good way to express characters that cannot be typed on a keyboard. ioL follows the Unicode standard (with UTF8 encoding for input and output characters). ioL is quite versatile with numbers and supports entry in multiple different number systems. Here are some examples of the lowercase letter z expressed in various ways:
Example | Interpretation |
---|---|
z | Typed directly on a keyboard |
</#122> | z can also be entered as character number 122 (decimal) in Unicode |
</#x7A> | ...which is the same as 7A in hexadecimal (note: x7A, not x7a) |
</#o172> | ...or 172 in octal... |
</#b1111010> | ... or 1111010 in binary. |
Review
- Open an ioL console in standard io mode using iol -. Enter the Michelangelo
quote from the example on the previous page so it shows up like this:
'I am still learning'When you're done, hit Ctrl+d on a new empty line to quit the ioL console.
  -- Michelangelo - Above, we used two hyphens, -- to represent a dash. We ought to use a real dash character instead, which looks like this: — (a dash is longer than a hyphen). The character code for a dash is 2014 in hexadecimal. Use an escape sequence to produce the dash character in the ioL console.