Performing Input and Output
In the spirit of other interpreted languages, APL is based on a REPL loop: read a command, evaluate it, print the results, and loop, making the simplest “Hello, world!” program trivial (the “Hello, world!” code is a joke!). However, implicit printing doesn’t work when the result is assigned to a variable. To force the printout, assign the result to the system variable ⎕ known as “quad.” (The box is really a box, not a placeholder for a missing character; see comment.) Non-incidentally, the variable looks like a screen or terminal window because it symbolizes your computer’s screen.
| | A←10 ⍝ No printout |
| | A ⍝ Implicit printout |
| | 10 |
| | ⎕←A←10 ⍝ Explicit printout |
| | 10 |
The last statement in the preceding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access