JanetDocsPlaygroundI'm feeling luckyGitHub sign in

array/peek



    cfunction
    src/core/array.c on line 173, column 1

    (array/peek arr)

    Returns the last element of the array. Does not modify the array.


1 exampleSign in to add an example
Loading...
# janet 1.10.1

(array/peek @[])     # => nil
(array/peek @[1])    # => 1
(array/peek @[1 2])  # => 2

(array/peek [1 2])           # error: expected array, got tuple
(array/peek (array [1 2]))   # => (1 2)
(array/peek (array ;[1 2]))  # => 2
cellularmitosisPlayground