From MiniScript Wiki
Jump to navigation Jump to search

input is a quasi-standard function in the MiniScript language that gets a string of input from the user. By "quasi-standard" we mean that it is not part of the MiniScript core, but several implementations support it, and embedders are encouraged to add support for it whenever possible.


Parameter Name Default Value Meaning
prompt "" string to display to the user

The prompt parameter is optional, and if supplied, is printed to output (as if with print). The script then blocks while the user types a response, terminated by Return or Enter. The text entered (without the terminating line break) is returned as the value of the function.

Note that input always returns a string. To interpret the input as a number, use val.


The following example asks the user's age, and then reports their age in dog years.

age = input("How old are you? ").val
print "That's " + age*7 + " in dog years."