Skip to content

Which operator is a ternary exactly? #37006

Open
@AndrewCushing

Description

@AndrewCushing

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content teamhelp wantedAnyone is welcome to open a pull request to fix this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions