Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SUB ValidateOption (Choice$, Min, Max, Flag)
- REM This subroutine will ensure that the OPTION selcted was valid. IF it IS valid
- REM Flag = 0, IF NOT Flag = 1
- PRINT
- SELECT CASE VAL(Choice$) AND Min AND Max
- CASE IS Max < INT(VAL(Choice$))
- Flag = 1
- PRINT "Sorry, but the value you have entered is far too big"
- PRINT "Please choose again between"; Min; "and"; Max
- CASE IS INT(VAL(Choice$)) < Min
- Flag = 1
- PRINT "Sorry, but the value you have entered is far too small"
- PRINT "Please choose again between"; Min; "and"; Max
- CASE IS LEN(Choice$) = 0
- Flag = 1
- PRINT "Sorry, but you have not entered a value"
- PRINT "Please choose a number between"; Min; "and"; Max
- CASE IS INT(VAL(Choice$)) > Min AND INT(VAL(Choice$)) < Max
- Flag = 0
- CASE IS ELSE
- Flag = 1
- PRINT "Sorry, but you are using inappropriate characters"
- PRINT "Please choose a number between"; Min; "and"; Max
- END SELECT
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement