This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Assign values to Variables
Values are assigned to variables creating an expression as follows: the variable is on the left side of the expression and the value you want to assign to the variable is on the right.
For example:
Dim B As Long
B = 200
Usually equal sign (=) is used for variable assignment operation like:
Counter = Counter + 1
thinBasic support also some pre-assignment operators very useful in many cases. Such operators are also called compound operators
For example the previous example can be reduced to:
Counter += 1
In this case thinBasic sum 1 to the current value of Counter variable.
The following tables summarize all the supported assignment operators.
Numeric assignments
Method |
Description |
Example |
Equal to |
= |
Assign right expression to a variable |
Counter = Idx |
|
+= |
Add right expression to variable before assigning result back to variable |
Counter += Idx |
Counter = Counter + Idx |
-= |
Subtract right expression from variable before assigning result back to variable |
Counter -= Idx |
Counter = Counter - Idx |
*= |
Multiply variable value to right expression before assigning result back to variable |
Counter *= Idx |
Counter = Counter * Idx |
/= |
Divide (floating point version) variable by right expression before assigning result back to variable |
Counter /= Idx |
Counter = Counter / Idx |
\= |
Divide (integer version) variable by right expression before assigning result back to variable |
Counter \= Idx |
Counter = Counter \ Idx |
String assignments
Method |
Description |
Example |
Equal to |
= |
Assign right expression to a variable |
MyString = "ABC" |
|
+= |
Add variable value to right expression before assigning result back to variable |
MyString += "ABC" |
MyString = MyString & "ABC" |
&= |
Add variable value to right expression before assigning result back to variable |
MyString &= "ABC" |
MyString = MyString & "ABC" |
.= |
Add variable value to right expression before assigning result back to variable |
MyString .= "ABC" |
MyString = MyString & "ABC" |