JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

first

core-api


    function
    boot.janet on line 901, column 1

    (first x)

    Get the first value in `x`.

    If `x` is a non-empty bytes or indexed type value, return the first 
    element.

    If `x` is a fiber, return the fiber's last value or `nil` if there 
    isn't one yet.

    If `x` is an abstract type value with a `get` method, call the 
    method with a key of `0`.

    In all other cases, return `nil`.


See also:lasttake2 examplesSign in to add an example
Loading...
(first [])  # => nil
(first "abc")  # => 97
AndriamanitraPlayground
(first [4 5 6])  # => 4
cellularmitosisPlayground