May 2018
Beginner
252 pages
6h 19m
English
In the previous chapter, we saw how to use do to evaluate a script in the console with do %script.red.
In fact, do is more general in that it accepts any expression, function, or block, such as here:
;-- see Chapter03/evaluating.red:do 9 * 9 ;== 81do square-root 25 ;== 5.0do [print [tab uppercase "Red"]] ; == "RED"
You can even use do %script.red from inside a Red program, that's how powerful it is. Let's make script.red containing—Red[] print "This is executed in a script". Now edit an evaluating.red program containing—Red[] do %script.red.
Then red evaluating.red will print the text, This is executed in a script in the console. To see the same output in a terminal compile it with red -r evaluating.red and then ...