Insert-Element
Command Description
Inserts an element at a specified position in an array
Command Prototype
arrRet = insert(array,postion,item)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
array | True | expression | [] | The array to insert an element into |
postion | True | number | 0 | Position to insert element |
item | True | expression | "" | The element to insert into the array |
return
arrRet,The variable used to save the output of the command.
Demo
TracePrint("----------------------Insert element ----------------------- -")
//-------------------------------------------------------------------------------
//[Remarks] Add an element to the specified position of the array.
//Input parameter 1:
// array--The array into which elements are to be inserted.
//Input parameter 2:
// postion--The position to insert the element.
//Input parameter 3:
// item--The element to insert into the array.
//out parameters:
// arrRet--The variable to which the output of the function call is saved.
//
//Command prototype: arrRet=insert(array,postion,item)
//-------------------------------------------------------------------------------
arrRet=insert([1,3,4],1,2)
TracePrint(arrRet)