Rename range example to prepare for expansion
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -0,0 +1,2 @@
|
||||
3d8c61f02f98892be9d3ff25d48da0bfb31bbd25
|
||||
S171w0PjgsD
|
@@ -1,4 +1,4 @@
|
||||
$ go run range.go
|
||||
$ go run range-over-built-in-types.go
|
||||
sum: 9
|
||||
index: 1
|
||||
a -> apple
|
@@ -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.
|
||||
|
@@ -1,2 +1,2 @@
|
||||
1812ab409c07ea4209106ee4c0d2eb597fccd717
|
||||
yQMclmwOYs9
|
||||
446dea3a7cb9e16ce3e17a6649c719e764936740
|
||||
8vAhX6eX1wy
|
||||
|
@@ -1,2 +0,0 @@
|
||||
c8da490660d234fc420f39d9b8a4aba27f8aba46
|
||||
kRsyWNmLFLz
|
2
public/functions
generated
2
public/functions
generated
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
if (e.key == "ArrowLeft") {
|
||||
window.location.href = 'range';
|
||||
window.location.href = 'maps';
|
||||
}
|
||||
|
||||
|
||||
|
4
public/index.html
generated
4
public/index.html
generated
@@ -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
4
public/maps
generated
@@ -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
2
public/pointers
generated
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
if (e.key == "ArrowLeft") {
|
||||
window.location.href = 'recursion';
|
||||
window.location.href = 'range-over-built-in-types';
|
||||
}
|
||||
|
||||
|
||||
|
23
public/range → public/range-over-built-in-types
generated
23
public/range → public/range-over-built-in-types
generated
@@ -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’s see how to use <code>range</code> with some
|
||||
of the data structures we’ve already learned.</p>
|
||||
<p><em>range</em> iterates over elements in a variety of
|
||||
built-in data structures. Let’s see how to
|
||||
use <code>range</code> with some of the data structures
|
||||
we’ve already learned.</p>
|
||||
|
||||
</td>
|
||||
<td class="code empty leading">
|
||||
@@ -46,7 +47,7 @@ of the data structures we’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 -> 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>
|
||||
|
||||
|
4
public/range-over-channels
generated
4
public/range-over-channels
generated
@@ -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
4
public/recursion
generated
@@ -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>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user