? Compilation I guess... ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Compilation I guess...

SB programs are compiled from top to bottom. During Compilation: When an expression is encountered: -If it is a numeric expression containing only constants (numbers, # constants, and PI()) and constant operators (- ! NOT * / DIV MOD + - << >> AND XOR OR), it is evaluated and replaced with the result. DATA only allows constant expressions and plain strings, otherwise an error occurs. OPTION STRICT enables strict mode for the rest of the program OPTION DEFINT enables integer mode for the rest of the program (unsuffixed variables default to integer type) When a variable is encountered (when not being created in VAR): -If inside a function, and no global or local variable with that name exists yet, a local variable is created (if in strict mode, an error happens) -If outside a function, and no global variable with that name exists yet, a global variable is created (if in strict mode, an error happens) When a variable is created: -If it has no type suffix, it becomes a real type (unless integer mode is enabled, when it becomes an integer) -# type suffix creates a real -% type suffix creates an integer -$ type suffix creates a string -[...] creates an array with up to 4 dimensions -Numbers are initialized to 0 -Strings are "" -Arrays are ??? When VAR is encountered: -If inside a function definition, an error occurs if a local variable exists with the same name, otherwise a local variable is created -If outside a function, an error occurs if a global variable exists with the same name, otherwise a global variable is created -Variables are created. -Numbers are initialized to 0 -Strings are "" -Arrays are ??? During Execution: USE: -compiles the code in a slot. EXEC: -compiles and runs the code in a slot. When VAR is executed: -Values are assigned to string/number variables -Arrays are initialized
Author
12Me21
Updated
Rating
2 votes
Categories
Keywords
0 Comment(s)