Returns the last element of an array, deleting that element from the array at the same time
#include <Array.au3>
_ArrayPop ( ByRef $aArray )
$aArray | Array to modify |
Success: | the last element of the array (see remarks). |
Failure: | sets the @error flag to non-zero. |
@error: | 1 - The Input Must be an array 2 - $aArray is not a 1D array 3 - $aArray is empty |
If $aArray has one element left, it will be set to "" after _ArrayPop() is used on it.
_ArrayAdd, _ArrayDelete, _ArrayInsert, _ArrayPush
#include <Array.au3>
#include <MsgBoxConstants.au3>
Local $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"
_ArrayDisplay($avArray, "$avArray BEFORE _ArrayPop()")
While UBound($avArray)
MsgBox($MB_SYSTEMMODAL, '_ArrayPop() return value', _ArrayPop($avArray))
_ArrayDisplay($avArray, "$avArray AFTER _ArrayPop()")
WEnd