31 lines
No EOL
2.2 KiB
HTML
31 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>Literals — Ludic</title>
|
||
<meta name="description" content="Integer, hex, character, string, boolean, and null-pointer literals.">
|
||
<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">Literals</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-operator">operator</span>
|
||
<h1 id="top">Literals</h1>
|
||
</div>
|
||
<code class="sig">42 0x1E90FF 'w' "text" true null</code>
|
||
<div class="desc"><p>Literals are the fixed values you write directly in source. <code>42</code> is a decimal <code>int</code> and <code>0x1E90FF</code> is a hex <code>int</code> — hex is how colors are written, so a raw color is just an integer. A number with a decimal point (<code>1.5</code>) is a <code>fixed</code>. <code>'w'</code> is a character literal, an <code>int</code> code point handy for comparing against <code>Input.key()</code>. <code>"text"</code> is a <code>string</code>, <code>true</code> / <code>false</code> are <code>bool</code>s, and <code>null</code> is the null-pointer literal used to test an unset record, slice, or <code>pointer</code> field.</p></div>
|
||
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">let sky_color: int = 0x1E90FF
|
||
let banner: string = "GAME OVER"
|
||
if Input.key() == 'w' { row = row - 1 }
|
||
if next_segment == null { is_tail = true }</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> |