Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concept: variables #700

Merged
merged 6 commits into from
Aug 22, 2024
Merged

Concept: variables #700

merged 6 commits into from
Aug 22, 2024

Conversation

glennj
Copy link
Contributor

@glennj glennj commented Aug 16, 2024

Next concept: variables

This one is much more terse. I may have swung the pendulum too far.

@glennj glennj requested a review from a team August 16, 2024 03:08
Bash has two kinds of data: strings and arrays.
We'll talk about arrays later.

You assign a variable like this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You assign a variable like this
You assign a variable (often shortened to var) like this:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it often shortened to var? That's news to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I mean, your next line is varname and not variablename ;) Or you can avoid shortening it in the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved this by using name="value" for the example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For teaching material, regardless, I do prefer using full names, even if it is often shortened in practice. Those that are not "acronyms and abbreviations as a first language" can then easily look up those words in an English dictionary, making interpretation and deciphering easier (especially on top of mult-language audience/readers being highly likely on this platform).

Comment on lines 28 to 30
Variables can also be called "parameters".
The difference is that a variable is assigned by you, the programmer.
A parameter can be a read-only variable that is set by the shell.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Variables can also be called "parameters".
The difference is that a variable is assigned by you, the programmer.
A parameter can be a read-only variable that is set by the shell.
Many variables are assigned by you, the programmer.
Some variables are set automatically by the shell.
These are called parameters.

As far as I know, bash doesn't many any of those read only.

Copy link
Contributor Author

@glennj glennj Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just this, ignoring any subtle differences?

Variables can also be called "parameters".
The two terms will be used interchangably in this document.

concepts/variables/introduction.md Outdated Show resolved Hide resolved
concepts/variables/introduction.md Show resolved Hide resolved
concepts/variables/introduction.md Outdated Show resolved Hide resolved

## Command Substitution

A very frequent operation you will do in bash scripts is to capture the output of a command and store it in a variable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc mentions "you" a whole lot and things "you will do". I think the prior doc was a little bit less ...directed?

Copy link
Contributor Author

@glennj glennj Aug 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I did lift most of the text from greycat for the last one. Maybe we can "put a pin in it" and revisit it after a few docs are written.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could modify the factoid messages and/or Wooledge wiki, if that helps :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon reflection, I'll circle back to the first concept to give it a rewrite in my voice.

concepts/variables/introduction.md Outdated Show resolved Hide resolved
concepts/variables/introduction.md Outdated Show resolved Hide resolved
concepts/variables/introduction.md Outdated Show resolved Hide resolved
concepts/variables/introduction.md Show resolved Hide resolved
@glennj glennj requested review from IsaacG and kotp August 18, 2024 15:38
Bash has two kinds of data: strings and arrays.
We'll talk about arrays later.

You assign a variable like this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I mean, your next line is varname and not variablename ;) Or you can avoid shortening it in the example.


## Command Substitution

A very frequent operation you will do in bash scripts is to capture the output of a command and store it in a variable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could modify the factoid messages and/or Wooledge wiki, if that helps :D

Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knowing that some rewrite to different voice is pending...

@@ -1,10 +1,10 @@
[
{
"description": "Commands and Arguments in the Bash Guide",
"description": "\"Commands and Arguments\" in the BashGuide",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In prose should "Bash Guide" be two words? That is why in code we would CamelCase them, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's literally a WikiWord, but that's not no common anymore.

Bash has two kinds of data: strings and arrays.
We'll talk about arrays later.

You assign a variable like this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For teaching material, regardless, I do prefer using full names, even if it is often shortened in practice. Those that are not "acronyms and abbreviations as a first language" can then easily look up those words in an English dictionary, making interpretation and deciphering easier (especially on top of mult-language audience/readers being highly likely on this platform).

@glennj glennj merged commit 139f0cd into exercism:main Aug 22, 2024
2 checks passed
@glennj
Copy link
Contributor Author

glennj commented Aug 22, 2024

@glennj glennj deleted the concept-variables branch August 22, 2024 01:26
@glennj glennj added x:module/concept Work on Concepts x:type/content Work on content (e.g. exercises, concepts) labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:module/concept Work on Concepts x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants