<< Click to Display Table of Contents >> Navigation: 3. Script Language > Variable Definitions and Operations > Variable Commands |
MiniRobotLanguage (MRL)
VAO. Command
Variable Once / Variable Clear
Intention
This command can be used to assign a Value to a Variable and it can be used to completely delete a Variable (Variable Clear).
It will resolve only 1 variable that can be given on the value side, that is the first variable name on the value side.
The VAO.-command does not makes a special folder and system-variables resolution.
The VAO.-command can be used to assign Variables to other Variables,
copying the content and preserving the Variable-Type.
For this on the Target-Side P2 must be just a Variable.
Here are two examples for this.
' Copy Variable Content from one Variable to another
VAO.$$TGA=§§_01
VAO.$$TGA=§§ABC
To delete a Variable from Memory you can type:
VAO.$$TGA
or
VAO.$$TGA=
Both will do exactly the same. Unlike with other Commands, this will not only clear the content of a variable, but delete the variable completely from memory. This is sometimes necessary. For example when you want to use the variable to get a result from a MACRO-Function.
When using the second form like this:
VAO.$$TGA=
Make sure that there are no spaces on the right side of the = sign.
Otherwise the Variable will just be assigned those spaces.
Syntax
VAO.P1[=P2]
Parameter Explanation
P1 - Variable-name
P2 - Value that will be assigned to the variable. If P2 is omitted, the variable will be
set to empty. If P2 is a Variable, then VAO. will just copy the content of
P1 into P2, this will preserve the original Type (Numeric, string etc.) of the
P2 - Variable.
Example
'**********************************
' VAO.
'**********************************
'DBM.2
'This will clear the variable:
VAO.$$ABC=
' This will assign the variable $$ABC the
' string:
' ?path\Hans$$AAB
: $$AAA=Hans
: $$AAB=Peter
VAO.$$ABC=?path\$$AAA$$AAB.txt
:over
MBX.Halt to read output
END.
'**********************************
' This example shows that VAO. can preserve
' the Variable-Type of an Variable
'**********************************
VAN.$$PAA=5.56
VAN.$$PAB=7
GSB.Add|$$PAA|$$PAB
MBX.Result is: $$RES
VAR.$$PAA=Max
VAR.$$PAB=Müller
GSB.Add|$$PAA|$$PAB
MBX.Result is: $$RES
END.
:Add
VAO.$$TGA=§§_01
GVT.$$TGA|§§TYP
DBP. Vartype is §§TYP.
CAL.§§TYA=(§§TYP=2)+(§§TYP=4)+(§§TYP=5)
IVV.§§TYP=1
$$RES=$$PAA,$$PAB
EIF.
IVV.§§TYA=1
CAL.$$RES=$$PAA+$$PAB
EIF.
RET.
ENR.
'**********************************
' This example shows that VAO. and VAI.
' to get the result of a Macro-Function
'**********************************
VAN.$$PAA=5.56
VAN.$$PAB=7
VAO.$REA
%Add $$PAA|$$PAB|$$REA
MBX.Result is: $$REA
VAR.$$PAA=Max
VAR.$$PAB=Müller
VAO.$$REA
%Add $$PAA|$$PAB|$$REA
MBX.Result is: $$REA
END.
'-----------------------------------------------------------
: %Add 3
GSB.Add|§§§01|§§§02|§§§03
END%
:Add
SAV.Save|$$ERG|$$TGA|$$TYP|$$PAA|$$PAB
VAR.$$PAA=§§_01
VAR.$$PAB=§§_02
VAO.$$ERG=§§_03
DBP.ERG=$$ERG
VAO.$$TGA=§§_01
GVT.$$TGA|$$TYP
DBP. Vartype is $$TYP.
CAL.$$TYA=($$TYP=2)+($$TYP=4)+($$TYP=5)
IVV.$$TYP=1
$$RES=$$PAA,$$PAB
EIF.
IVV.$$TYA=1
CAL.$$RES=$$PAA+$$PAB
EIF.
VAI.$$ERG=$$RES
SAV.Restore
RET.
ENR.
Remarks
Its important to understand that the VAO.-Command will not resolve Special-Folders and Special Variables, while it will resolve any other local or global variable names, but only the first one in the line.
Limitations:
-
See also:
• VAR. - Variable Set Value/Clear
• VAV. - Variables with Variables
• VBA. - Variable Binary Append
• CAL. - mathematical CALculation