JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

array/pop

core-api


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

    (array/pop arr)

    Remove and return the last value of an array `arr`. If `arr` is 
    empty, returns nil. Modifies `arr`.


3 examplesSign in to add an example
Loading...
(array/pop @[]) # => nil
jgartePlayground
(array/pop (range 12)) # => 11
jgartePlayground
(def a @[1 2])
(array/pop a)  # => 2
a              # => @[1]
(array/pop a)  # => 1
a              # => @[]
(array/pop a)  # => nil
a              # => @[]
cellularmitosisPlayground