How to enter only integers in REXX. The program I have manages to avoid some entries, but when the number contains a character such as a comma, percentage, cipher, among others, it causes the program to stop. How to validate these operations and let the program operate only with integer input.
do forever
call charout, "Enter number: "
pull NumInt
say
if (NumInt\== '') then
do
if (datatype(value(NumInt), 'W')) then
leave
else
do
say "Error: Enter only whole number."
say
end
end
else
do
say "Error: <Enter> key accidentally triggered."
say
end
end
say "Valid input provided: " || NumeroInteiro
say
call charout, "Press <Enter> to finish... "
pull
exit
Based on the structure of your program, I believe you want something like:
See the use of this in the code: