? Variable Types ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password

Variable Types


32 bit signed integer Variables ending in % are created as integers. VAR X% In DEFINT mode, variables with no suffix are created as integers. OPTION DEFINT:VAR X Numbers in the integer range without . E or # are integers. 714 # constants are integers. #LEFT Some functions/operators return integers. 5 DIV 2


64 bit floating point number Variables ending in # are created as real type. VAR Y# Without DEFINT mode, variables with no suffix are real. VAR Y Numbers outside the integer range, or that use . E or # are reals. 1.2 PI() is real type Some functions/operators return reals SIN(3)


16 bit char array Variables ending in $ are created as strings. VAR S$ Text in quotation marks, and label names (@EXAMPLE) are strings. "HELLO" Some functions/operators return strings STR$(7) Strings are passed to functions and assigned by reference. B$=A$:A$="TEST" 'B$ is "TEST" as well


Array of integers, reals, or strings. 1D-4D adding [] to a variable definition creates an array. VAR A$[12,7] Arrays are passed to functions and assigned by reference.


Nothing When function arguments are left out null is passed. SPOFS 0,,7 If an OUT variable is left undefined, null is returned. DEF TEST OUT B:END Leaving out the value after = will try to set a variable to null, causing an error. X= When null is used in place of an OUT variable, the value is thrown out. GPAGE OUT ,W


Nothing (2) Inside a function, OUT variables start off as undefined. DEF TEST OUT B ... When assigned to, they take the type of whatever is assigned to them. DEF TEST OUT B:B="HI" When returned from a function, they become null. When an array is created but the DIM/VAR hasn't been executed, it stays as undefined. GOTO @SKIP:DIM A[3]:@SKIP:A="LOL"
2 votes
2 Comment(s) 12Me21 12Me21 Head Admin Third Year My account is over 3 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself maybe "undefined" should really be called "unset" idk even though those basically mean the same thing "undefined"'s use in javascript might make this confusing ninjagnu ninjagnu Ummm is this TYPELESS? Like: X==1==3