Working interactively in the Red console
Like any dynamic language, Red has a REPL console. The red
command without arguments (open or double-click red.bat
) starts a graphical window console on Windows and macOS, and a command-line console on Linux. If you need a command-line console on Windows and macOS, just use the command red --cli
.
The console is a full Red interpreter and expects the input of Red code after the >>
prompt, to evaluate and then execute it when pressing Enter. It's a live interaction with the language. Simply giving it a value (here a string indicated by ""
) returns that value after the ==
:
;-- see Chapter02/console-examples.red: >> "Red is awesome" == "Red is awesome"
(You can find the source code of these examples in ch2/console-examples.red
. In all code files, we'll indicate the returned output with a ;==
prefix, like this, ;== "Red is awesome"
).
What happens if you type Red is awesome
in the console? The REPL throws an error at you—Script Error: is does...