37 lines
No EOL
2.2 KiB
HTML
37 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>Text.equals — Ludic</title>
|
||
<meta name="description" content="Whether two strings have identical bytes.">
|
||
<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="ns-text.html">Text</a> <span>›</span> <span class="here">Text.equals</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Text.equals</h1>
|
||
</div>
|
||
<code class="sig">Text.equals(a, b) -> bool</code>
|
||
<div class="desc"><p>Returns <code>true</code> when <code>a</code> and <code>b</code> hold the same bytes in the same order. This is a value comparison, not a pointer check, and is exactly what the <code>==</code> operator does between two strings — <code>Text.equals</code> is the named form for readability. Use it to match input against a keyword or compare a slice with an expected token.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-a"><code class="pname">a</code><span class="pdesc">the first string</span></div><div class="param" id="param-b"><code class="pname">b</code><span class="pdesc">the second string</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Guess {
|
||
var answer: string = "swordfish"
|
||
var attempt: string = "swordfish"
|
||
|
||
handler Check phase Update {
|
||
if Text.equals(attempt, answer) {
|
||
# correct
|
||
}
|
||
}
|
||
}</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> |