JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

eachk

core-api


    macro
    boot.janet on line 608, column 1

    (eachk binding x & body)

    Loop over each key in `x` with each key bound to `binding` with 
    destructuring support. Returns `nil`.

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


2 examplesSign in to add an example
Loading...
(eachk k [1 2 3] (print k))
# prints 0
# prints 1
# prints 2
# for indexed collections indices are printed  
pepePlayground
(eachk k {:a "a val" :b "b val" :c "c val"} (print k))
# prints c
# prints a
# prints b
pepePlayground