Correct inaccuracy in recursion description. (#554)

This commit is contained in:
wwwstephen
2024-09-23 14:00:36 +01:00
committed by GitHub
parent 17b2ecf8d7
commit 78ecc3f8c1
3 changed files with 9 additions and 9 deletions

View File

@@ -18,9 +18,9 @@ func fact(n int) int {
func main() {
fmt.Println(fact(7))
// Closures can also be recursive, but this requires the
// closure to be declared with a typed `var` explicitly
// before it's defined.
// Anonymous functions can also be recursive, but this requires
// explicitly declaring a variable with `var` to store
// the function before it's defined.
var fib func(n int) int
fib = func(n int) int {

View File

@@ -1,2 +1,2 @@
cdbd1a6957b3e2d7d9baa9efe4581ba4f8f3e753
MBTKk9VpAiK
5787b4a187dc208dcdae43c7fdc0ba19b821ed94
k4IRATLn9cE

8
public/recursion generated
View File

@@ -46,7 +46,7 @@ Here&rsquo;s a classic example.</p>
</td>
<td class="code leading">
<a href="https://go.dev/play/p/MBTKk9VpAiK"><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/k4IRATLn9cE"><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>
@@ -91,9 +91,9 @@ base case of <code>fact(0)</code>.</p>
<tr>
<td class="docs">
<p>Closures can also be recursive, but this requires the
closure to be declared with a typed <code>var</code> explicitly
before it&rsquo;s defined.</p>
<p>Anonymous functions can also be recursive, but this requires
explicitly declaring a variable with <code>var</code> to store
the function before it&rsquo;s defined.</p>
</td>
<td class="code leading">