I'd like to tell the user to input a digit from 1-9 (inclusive). The program is meant to repeat until the user has input a number from within that restrictions. However, the application will reject the input and not be recorded if the user gives an invalid input such as special characters or digits above 9 or below 0.
Unfortunately, it doesnt seem to work.......here is the code below....can someone help me out? thank you!
http://imgur.com/HmLVLhD
Offline
I don't think you need the "If answer if a number" factor.
Offline
set [valid? v] to [false] repeat until <(valid?) = [true]> ask [Integer 1-9?] and wait if <not <<(answer) = [0]> and <((answer) + (1)) = [0]>>> //This checks if it's a number or not. if <<(answer) > [1]> or <(answer) = [1]>> if <<(answer) < [9]> or <(answer) = [9]>> if <((answer) mod (1)) = [0]> set [valid? v] to [true] end end end end endI think that should work.
Last edited by mathfreak231 (2013-04-28 10:47:32)
Offline