This thread will show some of the enhanced language features of ScriptBasic. With VBScript being deprecated by Microsoft, ScriptBasic is the only embedded BASIC scripting language available going forward.
VariablesIn ScriptBasic, you don't declare types — the interpreter assigns and converts them automatically based on usage, making it dynamically typed but with predictable conversion rules. Variables are stored as a variant with the following internal types.
- undef - Indicates the variable hasn't been assigned a value yet.
- integer - Indicates this value is a whole number with a integer type.
- real - Indicates a real floating point type.
- string - Indicates a ScriptBasic string that can contain embedded nulls.
- stringz - Indicates a null terminated C style string.
- array - Indicates an array that could be indexed based, associative or a combination of both.
These examples show how type is assigned at use. The
& symbol indicates concatenating of strings.
a = 1
b = 2
c = "3"
d = "4"
PRINT a + b
PRINT a & b
PRINT c + d
PRINT c & d
Output:
3
12
7
34