Skip to main content

Delete-Specified-Element

Command Description

Delete the element at the specified position (counting from 0) in the array or dictionary

Command Prototype

Remove(varData,index)

Parameter Description

ParameterRequiredTypeDefaultDescription
varDataTrueexpression$PrevResultEnter the array or dictionary whose elements need to be deleted
indexTruenumber0Enter the position in the array (start from 0), or enter the key name in the dictionary

Demo

TracePrint("--------------------------------Delete the specified element------------ -------------------------") 
//[Remarks] Delete the element at the specified position (counting from 0) in the array, or delete the element with the specified key name in the dictionary.
//Input parameters:
// varData--Enter the array or dictionary whose elements need to be deleted.
// index--The position in the input array (counting from 0), or the key name in the input dictionary.
//out parameters:
// item--Assign the result of running the command to this variable.
TracePrint "-------------------------------Delete the specified element in the array----------- --------------------------------"
Dim varData=[1,2,3,4,2]
Remove(varData,4)
TracePrint "Remove the 5th element in the array varData:"
TracePrint varData