aboutsummaryrefslogtreecommitdiff
path: root/help/!assert assertwithmsg.md
blob: 80dfb85159ac7e4165e3031fde7c0167b11d209f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
*View this file with results and syntax highlighting [here](https://mlochbaum.github.io/BQN/help/!assert assertwithmsg.html).*

# Exclamation Mark (`!`)

`! 𝕩`: Assert

Throw an error if `𝕩` is not 1.

       ! 1
    1
       ! 2
    Error: Assertion error
    at ! 2
       ^
       ! "hello"
    Error: hello
    at ! "hello"


`𝕨 ! 𝕩`: Dyad

Throw an error with message `𝕨` if `𝕩` is not 1.

       "hi" ! 1
    1
       "two" ! 2
    Error: two
    at "two" ! 2
             ^
       "hello error" ! "hello"
    Error: hello error
    at "hello error" ! "hello"