home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Falcon 030 Power 2
/
F030_POWER2.iso
/
ST_STE
/
MAGS
/
ICTARI03.ARJ
/
ictari.03
/
GFA
/
TUTORIAL
/
WHILE.LST
< prev
Wrap
File List
|
1989-07-29
|
1KB
|
34 lines
' ** **
' ** Use Of WHILE ... WEND Loop To Validate Input **
' ** **
' ** In my opinion #ALL# input, of this form, should be validated: **
' ** Get input, While invalid: get input **
' ** **
'
' *** Get Surname ***
PRINT "Input Name (3-30 characters)"
INPUT "Name: ",surname$
'
' *** While Surname Invalid: Get Surname ***
WHILE LEN(surname$)<3 OR LEN(surname$)>30
PRINT CHR$(7);"INVALID NAME (3 TO 30 CHARACTERS ONLY)"
INPUT "Name: ",surname$
WEND
'
' *** Get Age ***
PRINT CHR$(10);"Input Age (15-150)"
INPUT "Age: ",age%
'
' *** While Age Invalid: Get Age ***
WHILE age%<15 OR age%>150
PRINT CHR$(7);"INVALID AGE (15 TO 150 ONLY)"
INPUT "Age: ",age%
WEND
'
' *** 'Process', Output And End ***
MUL age%,12
PRINT CHR$(10);"Hello ";surname$;", you`re over ";age%;" months old!"
PRINT CHR$(7);
VOID INP(2)
EDIT