Skip to main content

Add-to-Array-End

Command Description

Add elements to the array end and return the array

Command Prototype

arrRet = push(array,item)

Parameter Description

ParameterRequiredTypeDefaultDescription
arrayTrueexpression[]The array to be appended
itemTrueexpression""The element to prepend to the array

return

arrRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Add elements to the end of the array-------------------- ----") 
//-------------------------------------------------------------------------------
//[Remarks] Delete and return the last element of the array.
//Input parameter 1:
// array--Array to add elements to.
//Input parameter 2:
// item--The element to add to the array.
//out parameters:
// arrRet--The variable to which the output of the function call is saved.
//
//Command prototype: arrRet=push(array, item)
//-------------------------------------------------------------------------------
arrRet=push(["a","b"],"c")
TracePrint(arrRet)