Go to main content

last

Return last element from array.

LAST

NAME

last - Return last element from array.

SYNOPSIS

last(array)

DESCRIPTION

This function return the last element of an array. The array is not modified

So if a = [1,2,3,4,5]; last(a) return 5 and a has value 1,2,3,4,5.

Function last and tail are synonym.

PARAMETERS

array : required, the array to get element from.

RETURN

Returns the last element of an array.

EXAMPLES

        a = [1,2,3,4,5];

        a.top();

        a.last();

        a.shift();

        a;

        a.pop();

        a;

    will return es=151[2,3,4,5]5[2,3,4].

SEE ALSO

{{ include("includes/array.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.