ARS. - Array Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > ARS. - Array's > !ARS. - Array Operations >

ARS. - Array Operations

ARS.Set

Previous Top Next


MiniRobotLanguage (MRL)

 

ARS.Set

Sets the value at a specific index in the array.

 

 

Intention

 

The ARS.Set command sets the value at the specified index in the array. This is useful for modifying specific elements within the array.

 

Illustration:

📦 Original Array: [1, 2, 3, 4, 5]
🔢 Index to set: 3
🔢 Value to set: 99
📦 Modified Array: [1, 2, 99, 4, 5]
🔑 Handle: $$ARR

 

Syntax

 

ARS.Set|$$ARR|$$IND|$$VAL

 

 

Parameter Explanation

 

P1 - $$ARR - (Variable)

The handle of the array in which to set the value.

 

P2 - $$IND - (Variable)

The index at which to set the value.

 

P3 - $$VAL - (Variable)

The value to set at the specified index.

 

Example

 

'***********************************

' ARS.Set - 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.Set|$$ARR|2|99

DBP.New Modified array: [1, 2, 99, 4, 5]

ARR.End|$$ARR

'

'***********************************

' ARS.Set - 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.Set|$$ARR|3|999

DBP.New Modified array: [100, 200, 300, 999, 500]

ARR.End|$$ARR

'

'***********************************

' ARS.Set - 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.Set|$$ARR|2|9.9

DBP.New Modified array: [1.1, 9.9, 3.3, 4.4, 5.5]

ARR.End|$$ARR

'

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: