Variable Types ● SmileBASIC Source

Register

Integer

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

Real

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)

String

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

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.

Null

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

Undefined

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"
Updated
Rating
1 Comment(s) ninjagnu Avatar Taboo I didn't change my avatar for 180 days Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Ummm is this TYPELESS? Like: ``` X==1==3 ```