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

Documentation for semicolon #2163

Open
ygoe opened this issue Jul 20, 2020 · 4 comments
Open

Documentation for semicolon #2163

ygoe opened this issue Jul 20, 2020 · 4 comments
Labels

Comments

@ygoe
Copy link

ygoe commented Jul 20, 2020

Describe the bug
The documentation does not at all explain what a semicolon (;) means. I've seen them in scripts on Stack Overflow but I don't know what exactly it does. I have several if statements separated by a semicolon. Will the output be appended? Piped? Ignored?

@pkoppstein
Copy link
Contributor

pkoppstein commented Jul 21, 2020

@ygoe - Yes, neither the official tutorial nor the official manual makes explicit the important details about semicolons, but other (official) documents do. For example, the "jq Language Description" (https://github.com/stedolan/jq/wiki/jq-Language-Description) has these paragraphs:

Functions can have arguments. Again, function arguments are not value arguments but thunk arguments. Calling a function with arguments looks like this: bar(some_expression; another_expression). Pay close attention to the use of ; for separating argument expressions, and do not confuse it with , — , is an operator that joins the outputs of the expressions on its left and right, while ; is only a syntactic separator that separates function arguments and terminates function bodies.

Semi-colons are required for terminating import, include, and def function bodies, as well as for separating expression arguments to functions of more than one expression argument.

@ygoe
Copy link
Author

ygoe commented Jul 24, 2020

Oh, thanks. That clears it up. I discovered that those semicolons were in fact separating arguments of a foreach function before that. And I wasn't aware that there are multiple disjuct documents about jq. That's a bit confusing. Google just pointed me to the project website that gave so much documentation that I believed that was the one.

@huyz
Copy link

huyz commented Mar 2, 2023

It's still not in the official manual and I had to Google to find this issue explaining it.

@wader
Copy link
Member

wader commented Mar 2, 2023

Hi, see #2305 why things are not updating much atm

@itchyny itchyny added the docs label Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants