blob: e172ecbdeb944adf6d44ccaa9d29a8c13e948e45 (
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
|
<head>
<link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../style.css" rel="stylesheet"/>
<title>BQN: Exclamation Mark (`!`)</title>
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">help</a></div>
<h1 id="exclamation-mark-"><a class="header" href="#exclamation-mark-">Exclamation Mark (<code><span class='Function'>!</span></code>)</a></h1>
<h2 id="--assert"><a class="header" href="#--assert"><code><span class='Function'>!</span> <span class='Value'>𝕩</span></code>: Assert</a></h2>
<p>Throw an error if <code><span class='Value'>𝕩</span></code> is not 1.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ICAgISAxCgogICAhIDIKCiAgICEgImhlbGxvIg==">↗️</a><pre> <span class='Function'>!</span> <span class='Number'>1</span>
1
<span class='Function'>!</span> <span class='Number'>2</span>
<span class='Error'>Error: Assertion error</span>
<span class='Function'>!</span> <span class='String'>"hello"</span>
<span class='Error'>Error: hello</span>
</pre>
<h2 id="---dyad"><a class="header" href="#---dyad"><code><span class='Value'>𝕨</span> <span class='Function'>!</span> <span class='Value'>𝕩</span></code>: Dyad</a></h2>
<p>Throw an error with message <code><span class='Value'>𝕨</span></code> if <code><span class='Value'>𝕩</span></code> is not 1.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ICAgImhpIiAhIDEKCiAgICJ0d28iICEgMgoKICAgImhlbGxvIGVycm9yIiAhICJoZWxsbyI=">↗️</a><pre> <span class='String'>"hi"</span> <span class='Function'>!</span> <span class='Number'>1</span>
1
<span class='String'>"two"</span> <span class='Function'>!</span> <span class='Number'>2</span>
<span class='Error'>Error: two</span>
<span class='String'>"hello error"</span> <span class='Function'>!</span> <span class='String'>"hello"</span>
<span class='Error'>Error: hello error</span>
</pre>
|