FlexBASIC tips and tricks
A thread for some tips and tricks about FlexBASIC.
I'll start off with a really simple one: the handy keyword VAR to both declare a variable and initialize it, e.g.:
var x = 1 var y = "hello"
is basically equivalent to
dim x as integer x = 1 dim y as string y = "hello"
The type of the variable being declared is inferred from the expression used to initialize it.
There is one difference between DIM and VAR: at the top level of the program (not inside any subroutine or function) VAR always declares a local variable, whereas DIM declares a global variable that may be read by subroutines and functions.