How do I use the GNU Smalltalk REP-loop?


First of all, the REP loop (or REPL) is short for read-eval-print-loop: when invoked normally, GNU Smalltalk will read Smalltalk code, evaluate it, print the result, until it is exited.

While working in the REPL, GNU Smalltalk will automatically add a period at the end of a line (to terminate a statement) if the Smalltalk syntax allows it. If you don't want the statement to terminate (e.g. if you want to continue a keyword message on the next line), wrap the statement in parentheses. For example, instead of this:

'abc' copyFrom: 1  "does not work, evaluates this line separately..."
      to: 2        "... and gives an error on this line"

you can do this:

('abc' copyFrom: 1
       to: 2)

User login