29 lines
No EOL
2.2 KiB
HTML
29 lines
No EOL
2.2 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Logical — Ludic</title>
|
||
<meta name="description" content="The boolean combinators, spelled as words — never && or || or a bare !.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="api.html#operators">Operators & tokens</a> <span>›</span> <span class="here">Logical</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-operator">operator</span>
|
||
<h1 id="top">Logical</h1>
|
||
</div>
|
||
<code class="sig">and or not</code>
|
||
<div class="desc"><p>The boolean combinators are <code>and</code>, <code>or</code>, and <code>not</code>. They combine <code>bool</code> values — usually the results of comparisons — into the compound conditions an <code>if</code>, <code>while</code>, or <code>where</code> clause tests. Ludic spells them as <b>words, not symbols</b>: <code>&&</code> and <code>||</code> are not operators, and a bare <code>!</code> is rejected with a diagnostic pointing you to <code>not</code> (<code>!=</code> is unaffected). <code>and</code> binds tighter than <code>or</code>, so <code>a and b or c</code> groups as <code>(a and b) or c</code>; add parentheses when you mean otherwise.</p></div>
|
||
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">if pressed_key != 0 and not is_paused { apply_input() }
|
||
if current_health <= 0 or elapsed_frames > time_limit { become GameOver }</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |