User input/Graphical: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: XUL is no longer supported by Mozilla) |
m (→{{header|REXX}}: changed comments and whitespace, simplified the code.) |
||
Line 1,430: | Line 1,430: | ||
it verifies that the correct number has been entered. |
it verifies that the correct number has been entered. |
||
<lang rexx>/*REXX pgm prompts (using the OS GUI) for a string & then prompts for a specific number.*/ |
<lang rexx>/*REXX pgm prompts (using the OS GUI) for a string & then prompts for a specific number.*/ |
||
#= 75000 /*the number that must be entered. */ |
|||
x= |
|||
string= |
|||
N= |
|||
nubber= |
|||
do while x=' '; say /*string can't be blanks or null string*/ |
|||
say 'Please enter a string: ' |
|||
parse pull x |
|||
say 'Please enter a string: ' |
|||
if x='' then say '***error*** No string entered.' |
|||
⚫ | |||
if string='' then say '***error*** No string entered.' |
|||
⚫ | |||
do while N\=#; say /*the number (below) may be ill formed.*/ |
|||
say 'Please enter the number:' # |
|||
parse pull N |
|||
say 'Please enter the number:' # |
|||
if datatype(N, 'N') then N= N / 1 /*normalize the number: 007 4.0 +2 */ |
|||
if N\=# then say '***error*** The number is not correct: ' N. |
|||
⚫ | |||
if number\=# then say '***error*** The number is not correct: ' number |
|||
say |
|||
⚫ | |||
say |
say 'The string entered is:' x /*echo the values (string and number. */ |
||
say 'The |
say 'The number entered is:' N /*stick a fork in it, we're all done. */</lang><br><br> |
||
say 'The number entered is:' number |
|||
/*stick a fork in it, we're all done. */</lang><br><br> |
|||
=={{header|Ring}}== |
=={{header|Ring}}== |