get

Returns the element at a specified position in the list variable. Note that this method does not remove the element from the list.

Syntax:

$[ScriptVariable]::get(int index)

Parameters:

index (int): the index position of the element to return. If not specified, the assumed index value is 0, which is the index position of the first list element.

Example:

The following example illustrates using the get list method to retrieve the second element in a list variable and assign it to a string variable:

$recipients = "Engineering Group"

$recipients::add("Building 14")

$recipients::add("Winston Smythe")

$groupName = $recipients::get()

$location = $recipients::get(1)

print($groupName)

print($location)

Output:

Engineering Group

Building 14