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

Which operator is a ternary exactly? #37006

Open
1 task done
AndrewCushing opened this issue Mar 20, 2025 · 2 comments
Open
1 task done

Which operator is a ternary exactly? #37006

AndrewCushing opened this issue Mar 20, 2025 · 2 comments
Labels
content This issue or pull request belongs to the Docs Content team help wanted Anyone is welcome to open a pull request to fix this issue

Comments

@AndrewCushing
Copy link

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example

What part(s) of the article would you like to see updated?

GitHub offers ternary operator like behaviour that you can use in expressions. By using a ternary operator in this way,

In this example, we're using a ternary operator

This is simply not true. Furthermore, in the section above you don't even state which operators are unary and which are binary, but it certainly seems to be true that none of them are ternary. You also don't bother to state the order of operations, and then make use of exactly that order in the example. Are we to assume that the order you present the operators is the order? This seems a sensible order, but wouldn't it be worth adding a sentence to say so?

The ?: operator common in many languages is simply one kind of ternary operator. It is so named because it operates on three variables/expressions. You are using two binary operators to try to mimic this functionality, but that is not the same as using a ternary operator.

Additional information

No response

@AndrewCushing AndrewCushing added the content This issue or pull request belongs to the Docs Content team label Mar 20, 2025
Copy link

welcome bot commented Mar 20, 2025

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Mar 20, 2025
@sunbrye
Copy link
Contributor

sunbrye commented Mar 20, 2025

@AndrewCushing Thank you for opening this issue on the ternary operator ✨ You, or anyone else, are welcome to submit a PR with this fix.

@sunbrye sunbrye added help wanted Anyone is welcome to open a pull request to fix this issue and removed triage Do not begin working on this issue until triaged by the team labels Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team help wanted Anyone is welcome to open a pull request to fix this issue
Projects
None yet
Development

No branches or pull requests

2 participants