JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

any?

core-api


    function
    boot.janet on line 1732, column 1

    (any? x)

    Evaluates to the last element of `x` if all preceding elements are 
    falsey, `nil` if `x` is empty, or otherwise to the first truthy 
    element.

    `x` can be a bytes, indexed. dictionary, fiber, or abstract type 
    with suitable `get` and `next` methods.


See also:allsome2 examplesSign in to add an example
Loading...
(any? "")
# => nil

(any? "Hello")
# => 72

(any? @"Hello")
# => 72

(any? @[])
# => nil

(any? [])
# => nil

(any? {})
# => nil

(any? @{})
# => nil

(any? @[1 2 3 4])
# => 1 

(any? @{:a 2 :b 3})
# => 2
leobmPlayground
(any? [false false nil]) => nil
(any? [false false nil 1]) => 1
(any? [false false nil true]) => true
swlkrPlayground