JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

when

core-api


    macro
    boot.janet on line 235, column 1

    (when condition & body)

    Evaluates the body when the condition is true. Otherwise returns 
    nil.


2 examplesSign in to add an example
Loading...
(when (def x 10)
  (string "Got value: " x))
# "Got value: 10"

(when (def x nil)
  (string "Got value: " x))
# nil
yohannd1Playground
(def name "Joe")
(when (= name "Joe") "Hello Joe")
# "Hello Joe"


(when (not= 1 2) "not-equal")
# "not-equal"
leobmPlayground