|
<< 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.Del
Removes a value at a specific index from the array.
Intention
The ARS.Del command removes the element at the specified index from the array. This is useful for modifying the array by removing specific elements.
Illustration:
📦 Original Array: [1, 2, 3, 4, 5]
🔢 Index to delete: 2
📦 Modified Array: [1, 2, 4, 5]
🔑 Handle: $$ARR
Syntax
ARS.Del|$$ARR|$$IND
Parameter Explanation
P1 - $$ARR - (Variable)
The handle of the array from which to delete the element.
P2 - $$IND - (numeric or Variable)
The index of the element to be deleted from the array.
Example
'***********************************
' ARS.Del - Sample 1
'***********************************
ARS.New|$$ARR
ARS.Add|$$ARR|1
ARS.Add|$$ARR|2
ARS.Add|$$ARR|3
ARS.Add|$$ARR|4
ARS.Add|$$ARR|5
ARS.Del|$$ARR|2
DBP.New Array after deletion: [1, 2, 4, 5]
ARR.End|$$ARR
'
'***********************************
' ARS.Del - Sample 2
'***********************************
ARS.New|$$ARR|i
ARS.Add|$$ARR|100
ARS.Add|$$ARR|200
ARS.Add|$$ARR|300
ARS.Add|$$ARR|400
ARS.Add|$$ARR|500
ARS.Del|$$ARR|3
DBP.New Array after deletion: [100, 200, 300, 500]
ARR.End|$$ARR
'
'***********************************
' ARS.Del - Sample 3
'***********************************
ARS.New|$$ARR|f
ARS.Add|$$ARR|1.1
ARS.Add|$$ARR|2.2
ARS.Add|$$ARR|3.3
ARS.Add|$$ARR|4.4
ARS.Add|$$ARR|5.5
ARS.Del|$$ARR|1
DBP.New Array after deletion: [1.1, 3.3, 4.4, 5.5]
ARR.End|$$ARR
'
Remarks
-
Limitations:
-
See also:
•