The easiest way to get an input is to use the input word, as shown in the following code snippet:
;-- see Chapter04/getting-input.red:
print "Enter a number: "
num: input
print ["You entered the number" num "with" length? num "digits"]
When interpreted with the console through red getting-input.red or from within the console with do %getting-input.red, we get the following result when the number 89 is entered:
Enter a number:
89
You entered the number 89 with 2 digits
What is the datatype of num? If we try length? 89 in the console, we get a *** Script Error: length? does not allow integer! for its series argument. But length? "89" returns 2, so num must be of a string! type. Indeed, anything typed into the console is received by Red as a string. This is so for the input word, and...