Say that break and continue do not exist, since a loop section implies them
plan.org settled the loop story as "while/for with break/continue and return", so a reader will reach for them; they are not implemented and, unlike the rest, not refused by name either — they come back as unknown function.
This commit is contained in:
parent
6c34d4a66e
commit
23601f382d
@ -404,6 +404,12 @@ its fields, and omitted fields are zeroed.</p>
|
||||
<pre><code class="sh">104
|
||||
105</code></pre>
|
||||
|
||||
<p>Those are the bytes <code>h</code> and <code>i</code>. There is no character type — a
|
||||
byte is a <code>u8</code> — but there is a byte literal, so <code>\h</code> is 104 and
|
||||
<code>\space</code> is 32, and the prelude's <code>digit?</code> reads as
|
||||
<code>(and (>= b \0) (<= b \9))</code>. To see a byte as a letter rather than as a
|
||||
number, print a slice of them with <code>print-bytes</code>.</p>
|
||||
|
||||
<p>An enum is an <code>i32</code> at run time and its own type in the checker. That is
|
||||
what makes a keyword at a call site useful: <code>:space</code> resolves against the
|
||||
parameter's enum type at compile time, and a typo is an error there rather than a wrong
|
||||
@ -518,7 +524,10 @@ a body that changes it cannot change the trip count, and the loop variable is no
|
||||
assignable.</p>
|
||||
|
||||
<p>Loops are imperative, with <code>while</code>, <code>until</code> and
|
||||
<code>return</code>. There is no <code>loop</code>/<code>recur</code>.</p>
|
||||
<code>return</code>. There is no <code>loop</code>/<code>recur</code>, and there is no
|
||||
<code>break</code> or <code>continue</code> either — both are planned and neither
|
||||
exists, so today they report as <code>unknown function break</code>. An early exit out
|
||||
of a loop is <code>return</code>, as <code>first-even</code> does above.</p>
|
||||
|
||||
<h3>Option, <code>match</code> and <code>some</code></h3>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user