Skip to content

Rust Needs The Ternary Conditional Operator (-?-:-) #1362

Description

@dangerrust

Hello,

It looks like Rust forgot to implement the ternary conditional operator

It's operator that looks like this: condition ? trueExpression : falseExpression

This important feature lets you do things like return value == 5 ? success : failure;

Without this Ternary Conditional Operator you must use if statements which make ugly duplicated code (leads to bugs)

I think it easy to add support for this in Rust

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions