Normally you need to know what type the data is (string vs int vs float) before using READ, but if the variable you use is untyped, its type will change to the type of the data.
There are basically 2 ways to get untyped vars:
DEF TEST OUT X
'OUT variables start as untyped
READ X
ENDor
IF 0 THEN DIM A[0] 'arrays are untyped until the DIM is executed, and if it's skipped, the var stays untyped
READ A
So you can easily make a function that reads any type of data:
DEF READ_ANY OUT IS_STRING,NUM,STR
IF 0 THEN DIM A[0]
READ A
IF (A||0)==3 THEN 'Bug: || returns 3 when first arg is a string (a safer way to check might be (A*0 && A*0==A*0) or something
STR=A:NUM=0:IS_STRING=#TRUE
ELSE
NUM=A:STR="":IS_STRING=#FALSE
ENDIF
END
2 Comment(s)randoIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthSecond YearMy account is over 2 years oldWebsiteForum LeaderHiddenAchievementsinterestingCyberYoshi64Intermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthNight PersonI like the quiet night and sleep late.Express YourselfGreat PageHiddenAchievementsOh, that boolean returning 3? ""==var==3...
cool