Repository navigation
Add the lasagna concept exercise for variables - #985
Conversation
- New wip concept exercise teaching variables with the Lasagna story: assignment, expansion, positional parameters, default values and command substitution, using expr for arithmetic. - Trim concepts/variables/introduction.md to what the exercise teaches; the full material remains in about.md. - Register the exercise in config.json. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| * `"$@"` expands to the list of all of the positional parameters, each as a separate word. | ||
| * `"$*"` expands to a single string of all the positional parameters joined together by a character. | ||
| * The join character is _the first character_ of the `$IFS` variable, which is a space by default. | ||
| ## Default Values |
There was a problem hiding this comment.
Default value is a type of parameter expansion ... which is a term that didn't get mentioned. Is that worth discussing?
There was a problem hiding this comment.
I don't follow you. Parameter expansion is discussed 2 sections above this.
There was a problem hiding this comment.
My apologies.
The way this is written, parameter expansion and default values are two separate sections, ergo different topics. The section above is one type of parameter expansion. Default values is another parameter expansion. I would suggest having them grouped under a parameter expansion header with parameter expansion described at a higher level (one sentence about bash expanding $<thing>). Under that, the basic parameter expansion is $var and default values is another type.
Does that make sense?
There was a problem hiding this comment.
it does, but I think they are fine being separate sections at the same level as Parameter Expansion. The Default Value section in the introduction could use some more words about default value being just one of several kinds of manipulations
- Introduce arithmetic expansion and "magic numbers" in the variables concept. - Replace expr with arithmetic expansion in the lasagna docs and exemplar. - In the arithmetic concept, refer back to the variables lesson instead of introducing arithmetic expansion again. - Restore the style guide advice about braces to the variables introduction. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
b6fec6f to
ecc7ed3
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This PR has been translated 🚀 |
Trim concepts/variables/introduction.md to what the exercise teaches; the full material remains in about.md.