|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > ARS. - Array's > !ARS. - Array Operations > ARS. - Array Operations |
MiniRobotLanguage (MRL)
ARS.Add
Add an element to the Array
Intention
The ARS.Add command adds a new element to the specified array. The element is appended to the end of the array.
Illustration:
Before ARS.Add:
[1, 2, 3]
After ARS.Add|$$ARR|4:
[1, 2, 3, 4]
Syntax
ARS.Add|$$ARR|$$VAL
Parameter Explanation
P1 - $$ARR (Variable)
This variable holds the handle of the array to which the element will be added.
P2 - $$VAL (Variable or Value)
The value or variable containing the value to be added to the array.
Example
'***********************************
' ARS.Add - Sample 1
'***********************************
ARS.New|$$ARR
ARS.Add|$$ARR|10
ARS.Add|$$ARR|20
ARS.Show|$$ARR
' Output: [10, 20]
ENR.
'***********************************
' ARS.Add - Sample 2
'***********************************
ARS.New|$$ARR
ARS.Add|$$ARR|"Hello"
ARS.Add|$$ARR|"World"
ARS.Show|$$ARR
' Output: ["Hello", "World"]
ENR.
'***********************************
' ARS.Add - Sample 3
'***********************************
ARS.New|$$ARR
ARS.Add|$$ARR|3.14
ARS.Add|$$ARR|2.71
ARS.Show|$$ARR
' Output: [3.14, 2.71]
ENR.
Remarks
-
Limitations:
- The array must be initialized before using this command.
See also:
• ARS.New
• ARS.Show