|
<< 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.Count
Returns the number of items in the array.
Intention
The ARS.Count command returns the number of items in the specified array. This is useful for determining the size of the array.
Illustration:
📦 Array: [1, 2, 3, 4, 5]
🔢 Count: 5
🔑 Handle: $$ARR
🔑 Result stored in $$RES
Syntax
ARS.Count|$$ARR[|$$RES]
Parameter Explanation
P1 - $$ARR - (Variable)
The handle of the array to count the items in.
P2 - $$RES (optional) - (Variable)
The variable to store the count of items. If omitted, the count is placed on the Top of Stack (TOS).
Example
'***********************************
' ARS.Count - Sample 1
'***********************************
ARS.New|$$ARR
ARS.Add|$$ARR|1
ARS.Add|$$ARR|2
ARS.Add|$$ARR|3
ARS.Count|$$ARR|$$RES
DBP.New Count of items: $$RES
ARR.End|$$ARR
'
'***********************************
' ARS.Count - Sample 2
'***********************************
ARS.New|$$ARR|i
ARS.Add|$$ARR|100
ARS.Add|$$ARR|200
ARS.Add|$$ARR|300
ARS.Count|$$ARR
DBP.New Count of items on TOS
ARR.End|$$ARR
'
'***********************************
' ARS.Count - Sample 3
'***********************************
ARS.New|$$ARR|f
ARS.Add|$$ARR|1.1
ARS.Add|$$ARR|2.2
ARS.Add|$$ARR|3.3
ARS.Count|$$ARR|$$RES
DBP.New Count of items: $$RES
ARR.End|$$ARR
'
Remarks
-
Limitations:
-
See also:
•