Refactor: Simplify counter example, remove explicit return

This commit is contained in:
2025-09-15 13:14:01 -07:00
parent 120d41e951
commit 5c3b57c866

View File

@@ -49,7 +49,7 @@
.markdown-body code { .markdown-body code {
font-family: 'JetBrains Mono', monospace; font-family: 'JetBrains Mono', monospace;
font-size: 13px; font-size: 13px;
font-variant-ligatures: none; /* Your requested change, Master */ font-variant-ligatures: none;
} }
:not(pre) > code { :not(pre) > code {
font-size: 85%; font-size: 85%;
@@ -137,15 +137,12 @@ counter: {
inc: { inc: {
value = value + 1 // Mutates parent's private state value = value + 1 // Mutates parent's private state
} _("The count is now: " + value)
get: {
^ value // The last expression is returned, use ^ to be explicit
} }
} }
counter.inc() counter.inc() // Prints "The count is now: 1"
_(counter.get()) // Prints 1 counter.inc() // Prints "The count is now: 2"
\`\`\` \`\`\`
### Blocks with Parameters ### Blocks with Parameters