Command-line arguments are captured in the system/script/args word. It is one string in which all arguments are stored, separated by a space:
;-- see Chapter10/args.red:print system/script/args ;== "78 A Red"type? system/script/args ;== string!args: split system/script/args " " ;== ["78" "A" "Red"]print ["Number of command-line arguments:" length? args] ;== Number of command-line arguments: 3foreach arg args [ print arg]; 78; A; Red
We can use split to obtain the separated arguments in an args series, and start using them.
To see the output, start the program with red args.red 78 A Red, or after compiling with red -r, start it with: ./args 78 A Red .