JanetDocsI'm feeling luckyGithub sign in

array/peek



    cfunction

    (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
cellularmitosis