JanetDocsPlaygroundI'm feeling luckyGitHub sign in

assert



    function
    boot.janet on line 152, column 1

    (assert x &opt err)

    Throw an error if x is not truthy.


2 examplesSign in to add an example
Loading...
(assert :dude :what?) # => :dude

(assert :dude :dude) # => :dude

(assert (= :dude :what?) "Where's my car?")
# => error: Where's my car?
# =>  in _thunk [repl] (tailcall) on line 84, column 1

(assert (= :dude :dude) "Where's my car?") # => true

jgartePlayground
(var a 0)
(assert (pos? a) "A is definitely not positive")
# error: A is definitely not positive
#  in assert [boot.janet] on line 149, column 11
#  in _thunk [repl] (tailcall) on line 3, column 1
pepePlayground