JanetDocsPlaygroundI'm feeling luckyGitHub sign in

return



    function
    boot.janet on line 375, column 1

    (return to &opt value)

    Return to a prompt point.


See also:prompt2 examplesSign in to add an example
Loading...
(label result
  (each x [0 1 2 3]
    (when (= x 3)
      (print "reached the end"))
    (when (= x 2)
      (return result 8))))
# => 8
sogaiuPlayground
(print
  (prompt :a 
          (for i 0 1000000000000 
            (print (string "i=" i))
            (if (= i 2) 
                (return :a 10)))))
# output:
# i=0
# i=1
# i=2
# 10
felixrPlayground