Rename range example to prepare for expansion

This commit is contained in:
Eli Bendersky
2024-08-21 06:13:09 -07:00
parent f7120b2cc1
commit d51709a171
14 changed files with 33 additions and 31 deletions

View File

@@ -8,12 +8,12 @@ Switch
Arrays
Slices
Maps
Range
Functions
Multiple Return Values
Variadic Functions
Closures
Recursion
Range over Built-in Types
Pointers
Strings and Runes
Structs

View File

@@ -1,6 +1,7 @@
// _range_ iterates over elements in a variety of data
// structures. Let's see how to use `range` with some
// of the data structures we've already learned.
// _range_ iterates over elements in a variety of
// built-in data structures. Let's see how to
// use `range` with some of the data structures
// we've already learned.
package main

View File

@@ -0,0 +1,2 @@
3d8c61f02f98892be9d3ff25d48da0bfb31bbd25
S171w0PjgsD

View File

@@ -1,4 +1,4 @@
$ go run range.go
$ go run range-over-built-in-types.go
sum: 9
index: 1
a -> apple

View File

@@ -1,4 +1,4 @@
// In a [previous](range) example we saw how `for` and
// In a [previous](range-over-built-in-types) example we saw how `for` and
// `range` provide iteration over basic data structures.
// We can also use this syntax to iterate over
// values received from a channel.

View File

@@ -1,2 +1,2 @@
1812ab409c07ea4209106ee4c0d2eb597fccd717
yQMclmwOYs9
446dea3a7cb9e16ce3e17a6649c719e764936740
8vAhX6eX1wy

View File

@@ -1,2 +0,0 @@
c8da490660d234fc420f39d9b8a4aba27f8aba46
kRsyWNmLFLz

2
public/functions generated
View File

@@ -12,7 +12,7 @@
}
if (e.key == "ArrowLeft") {
window.location.href = 'range';
window.location.href = 'maps';
}

4
public/index.html generated
View File

@@ -53,8 +53,6 @@
<li><a href="maps">Maps</a></li>
<li><a href="range">Range</a></li>
<li><a href="functions">Functions</a></li>
<li><a href="multiple-return-values">Multiple Return Values</a></li>
@@ -65,6 +63,8 @@
<li><a href="recursion">Recursion</a></li>
<li><a href="range-over-built-in-types">Range over Built-in Types</a></li>
<li><a href="pointers">Pointers</a></li>
<li><a href="strings-and-runes">Strings and Runes</a></li>

4
public/maps generated
View File

@@ -17,7 +17,7 @@
if (e.key == "ArrowRight") {
window.location.href = 'range';
window.location.href = 'functions';
}
}
@@ -250,7 +250,7 @@ printed with <code>fmt.Println</code>.</p>
<p class="next">
Next example: <a href="range">Range</a>.
Next example: <a href="functions">Functions</a>.
</p>

2
public/pointers generated
View File

@@ -12,7 +12,7 @@
}
if (e.key == "ArrowLeft") {
window.location.href = 'recursion';
window.location.href = 'range-over-built-in-types';
}

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Go by Example: Range</title>
<title>Go by Example: Range over Built-in Types</title>
<link rel=stylesheet href="site.css">
</head>
<script>
@@ -12,27 +12,28 @@
}
if (e.key == "ArrowLeft") {
window.location.href = 'maps';
window.location.href = 'recursion';
}
if (e.key == "ArrowRight") {
window.location.href = 'functions';
window.location.href = 'pointers';
}
}
</script>
<body>
<div class="example" id="range">
<h2><a href="./">Go by Example</a>: Range</h2>
<div class="example" id="range-over-built-in-types">
<h2><a href="./">Go by Example</a>: Range over Built-in Types</h2>
<table>
<tr>
<td class="docs">
<p><em>range</em> iterates over elements in a variety of data
structures. Let&rsquo;s see how to use <code>range</code> with some
of the data structures we&rsquo;ve already learned.</p>
<p><em>range</em> iterates over elements in a variety of
built-in data structures. Let&rsquo;s see how to
use <code>range</code> with some of the data structures
we&rsquo;ve already learned.</p>
</td>
<td class="code empty leading">
@@ -46,7 +47,7 @@ of the data structures we&rsquo;ve already learned.</p>
</td>
<td class="code leading">
<a href="https://go.dev/play/p/kRsyWNmLFLz"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<a href="https://go.dev/play/p/S171w0PjgsD"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">main</span></span></span></code></pre>
</td>
</tr>
@@ -162,7 +163,7 @@ details.</p>
</td>
<td class="code">
<pre class="chroma"><code><span class="line"><span class="cl"><span class="gp">$</span> go run range.go
<pre class="chroma"><code><span class="line"><span class="cl"><span class="gp">$</span> go run range-over-built-in-types.go
</span></span><span class="line"><span class="cl"><span class="go">sum: 9
</span></span></span><span class="line"><span class="cl"><span class="go">index: 1
</span></span></span><span class="line"><span class="cl"><span class="go">a -&gt; apple
@@ -178,7 +179,7 @@ details.</p>
<p class="next">
Next example: <a href="functions">Functions</a>.
Next example: <a href="pointers">Pointers</a>.
</p>

View File

@@ -30,7 +30,7 @@
<tr>
<td class="docs">
<p>In a <a href="range">previous</a> example we saw how <code>for</code> and
<p>In a <a href="range-over-built-in-types">previous</a> example we saw how <code>for</code> and
<code>range</code> provide iteration over basic data structures.
We can also use this syntax to iterate over
values received from a channel.</p>
@@ -47,7 +47,7 @@ values received from a channel.</p>
</td>
<td class="code leading">
<a href="https://go.dev/play/p/yQMclmwOYs9"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<a href="https://go.dev/play/p/8vAhX6eX1wy"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
<pre class="chroma"><code><span class="line"><span class="cl"><span class="kn">package</span> <span class="nx">main</span></span></span></code></pre>
</td>
</tr>

4
public/recursion generated
View File

@@ -17,7 +17,7 @@
if (e.key == "ArrowRight") {
window.location.href = 'pointers';
window.location.href = 'range-over-built-in-types';
}
}
@@ -159,7 +159,7 @@ knows which function to call with <code>fib</code> here.</p>
<p class="next">
Next example: <a href="pointers">Pointers</a>.
Next example: <a href="range-over-built-in-types">Range over Built-in Types</a>.
</p>