|
Definition:
|
atom a = prompt_number(string prompt, sequence range={})
|
|
Description:
|
Prompt the user to enter a number. The prompt parameter is a string of text that is displayed on the screen.
The range parameter can be a sequence of two values {lower, upper} which determine the range of values
that the user may enter. If a user enters a number that is less than lower or greater than upper, they
will be prompted again. If the range parameter is not supplied or explictly {} as per the default, there
are no restrictions on the number that can be entered and returned by this routine.
|
|
pwa/p2js:
|
Not supported. JavaScript simply cannot "stop executing" while it waits
for user input, instead you must specify a routine for it to call after they have, so any (legacy) code using this routine
is just simply not structured in the right way to be able to be run in a browser, not that it should be overly difficult to
refactor into something that can (and no longer uses this), using (say) KEY, or perhaps
more relevantly a VALUE_CHANGED handler on a gText().
|
|
Comments:
|
If this routine is too simple for your needs, feel free to copy (and ideally rename) it and make your
own more specialized version. You can find the original in builtins\get.e
|
|
Example 1:
|
age = prompt_number("What is your age? ", {0, 150})
|
|
Example 2:
|
t = prompt_number("Enter a temperature in Celcius:\n", {})
|
|
See Also:
|
get,
prompt_string
|