BASIC
This can
be a
handy short-cut in
examining addresses, for example.
Example Program:
940 REM "WHAT SIDE OF STREET?"
950 REM EVEN
=
NORTH. ODD
=
SOUTH
960 INPUT "ADDRESS: NUMBER AND STREET"? AD*
970
C
=
INT(VAL(AD*)/2)
*
2
980 IF C
=
VAL < AD*) THEN PRINT "NORTH SIDE":
GOTO 960
990 PRINT "SOUTH SIDE": GOTO 960
RUN the program,
entering
street
addresses like
"1015
SEVENTH AVE'
'
.
If the string is non-numeric or
null, val returns
a
zero.
Note: val will not always return the
correct value of
negative numbers although it
does
return the correct value of
positive numbers.
171