mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 14:48:40 +01:00
147 lines
5.4 KiB
HTML
147 lines
5.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
|
<title>Range Class – Wren</title>
|
|
<script type="application/javascript" src="../../prism.js" data-manual></script>
|
|
<script type="application/javascript" src="../../wren.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="../../prism.css" />
|
|
<link rel="stylesheet" type="text/css" href="../../style.css" />
|
|
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic|Source+Code+Pro:400|Lato:400|Sanchez:400italic,400' rel='stylesheet' type='text/css'>
|
|
<!-- Tell mobile browsers we're optimized for them and they don't need to crop
|
|
the viewport. -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
|
</head>
|
|
<body id="top" class="module">
|
|
<header>
|
|
<div class="page">
|
|
<div class="main-column">
|
|
<h1><a href="../../">wren</a></h1>
|
|
<h2>a classy little scripting language</h2>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="page">
|
|
<nav class="big">
|
|
<a href="../../"><img src="../../wren.svg" class="logo"></a>
|
|
<ul>
|
|
<li><a href="../">Back to Modules</a></li>
|
|
</ul>
|
|
<section>
|
|
<h2>core classes</h2>
|
|
<ul>
|
|
<li><a href="bool.html">Bool</a></li>
|
|
<li><a href="class.html">Class</a></li>
|
|
<li><a href="fiber.html">Fiber</a></li>
|
|
<li><a href="fn.html">Fn</a></li>
|
|
<li><a href="list.html">List</a></li>
|
|
<li><a href="map.html">Map</a></li>
|
|
<li><a href="null.html">Null</a></li>
|
|
<li><a href="num.html">Num</a></li>
|
|
<li><a href="object.html">Object</a></li>
|
|
<li><a href="range.html">Range</a></li>
|
|
<li><a href="sequence.html">Sequence</a></li>
|
|
<li><a href="string.html">String</a></li>
|
|
<li><a href="system.html">System</a></li>
|
|
</ul>
|
|
</section>
|
|
</nav>
|
|
<nav class="small">
|
|
<table>
|
|
<tr>
|
|
<td><a href="../">Modules</a></td>
|
|
<td><a href="./">core</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2"><h2>core classes</h2></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<ul>
|
|
<li><a href="bool.html">Bool</a></li>
|
|
<li><a href="class.html">Class</a></li>
|
|
<li><a href="fiber.html">Fiber</a></li>
|
|
<li><a href="fn.html">Fn</a></li>
|
|
<li><a href="list.html">List</a></li>
|
|
<li><a href="map.html">Map</a></li>
|
|
<li><a href="null.html">Null</a></li>
|
|
</ul>
|
|
</td>
|
|
<td>
|
|
<ul>
|
|
<li><a href="num.html">Num</a></li>
|
|
<li><a href="object.html">Object</a></li>
|
|
<li><a href="range.html">Range</a></li>
|
|
<li><a href="sequence.html">Sequence</a></li>
|
|
<li><a href="string.html">String</a></li>
|
|
<li><a href="system.html">System</a></li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</nav>
|
|
<main>
|
|
<h1>Range Class</h1>
|
|
<p>A range defines a bounded range of values from a starting point to a possibly
|
|
exclusive endpoint. <a href="../../values.html#ranges">Here</a> is a friendly introduction.</p>
|
|
<p>Extends <a href="sequence.html">Sequence</a>.</p>
|
|
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
|
|
<h3><strong>from</strong> <a href="#from" name="from" class="header-anchor">#</a></h3>
|
|
<p>The starting point of the range. A range may be backwards, so this can be
|
|
greater than [to].</p>
|
|
<pre class="snippet">
|
|
System.print((3..5).from) //> 3
|
|
System.print((4..2).from) //> 4
|
|
</pre>
|
|
|
|
<h3><strong>to</strong> <a href="#to" name="to" class="header-anchor">#</a></h3>
|
|
<p>The endpoint of the range. If the range is inclusive, this value is included,
|
|
otherwise it is not.</p>
|
|
<pre class="snippet">
|
|
System.print((3..5).to) //> 5
|
|
System.print((4..2).to) //> 2
|
|
</pre>
|
|
|
|
<h3><strong>min</strong> <a href="#min" name="min" class="header-anchor">#</a></h3>
|
|
<p>The minimum bound of the range. Returns either <code>from</code>, or <code>to</code>, whichever is
|
|
lower.</p>
|
|
<pre class="snippet">
|
|
System.print((3..5).min) //> 3
|
|
System.print((4..2).min) //> 2
|
|
</pre>
|
|
|
|
<h3><strong>max</strong> <a href="#max" name="max" class="header-anchor">#</a></h3>
|
|
<p>The maximum bound of the range. Returns either <code>from</code>, or <code>to</code>, whichever is
|
|
greater.</p>
|
|
<pre class="snippet">
|
|
System.print((3..5).max) //> 5
|
|
System.print((4..2).max) //> 4
|
|
</pre>
|
|
|
|
<h3><strong>isInclusive</strong> <a href="#isinclusive" name="isinclusive" class="header-anchor">#</a></h3>
|
|
<p>Whether or not the range includes <code>to</code>. (<code>from</code> is always included.)</p>
|
|
<pre class="snippet">
|
|
System.print((3..5).isInclusive) //> true
|
|
System.print((3...5).isInclusive) //> false
|
|
</pre>
|
|
|
|
<h3><strong>iterate</strong>(iterator), <strong>iteratorValue</strong>(iterator) <a href="#iterate(iterator),-iteratorvalue(iterator)" name="iterate(iterator),-iteratorvalue(iterator)" class="header-anchor">#</a></h3>
|
|
<p>Iterates over the range. Starts at <code>from</code> and increments by one towards <code>to</code>
|
|
until the endpoint is reached.</p>
|
|
</main>
|
|
</div>
|
|
<footer>
|
|
<div class="page">
|
|
<div class="main-column">
|
|
<p>Wren lives
|
|
<a href="https://github.com/wren-lang/wren">on GitHub</a>
|
|
— Made with ❤ by
|
|
<a href="http://journal.stuffwithstuff.com/">Bob Nystrom</a> and
|
|
<a href="https://github.com/wren-lang/wren/blob/master/AUTHORS">friends</a>.
|
|
</p>
|
|
<div class="main-column">
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|