Pop
Description
The Pop()
method removes the last element from the array and returns that element. This method changes the length of the array.
Syntax
expression.Pop()
Parameters
None
Returns
- Type
Variant
- Description
- The last element from the array.
Example
Public Sub PopExample()
Dim result As String
Dim MyArray As BetterArray
Set MyArray = New BetterArray
MyArray.Push "Banana", "Orange", "Apple", "Mango"
result = MyArray.Pop
' expected output:
' result = "Mango"
' MyArray now contains "Banana", "Orange", "Apple"
End Sub