Your first Rush lines
Print a line, bind a name to a value, and learn the one rule every line must follow.
This browser does not allow saving progress, so your stars and XP will be lost when you leave.
Video
The video for this lesson has not been recorded yet.
Read
A Rush program is a list of lines, and every line has to do something. The smallest useful line prints text. To print, call write:
write['hello world']Look at the square brackets. In Rush, [ and ] are the only grouping brackets: the arguments of a call go inside them, with commas between arguments, as in f[a, b]. Parentheses are refused outside text. The text goes to standard output.
To remember a value, bind a name to it with =. Rush has no variables: a bind joins a label, a name without quotes, to a value. Then write[x] prints the value bound to x:
x = 5
write[x]One rule governs every line: a line must bind, call or route. A line that only names a value, like 5 on its own, does nothing, so Rush refuses it with the error RX0065 before anything runs.
Exercises
This is the last lesson written so far.
Stars, XP and confetti are only symbols: they do not unlock or cost anything. They are here to make you want to keep going.
