Skip to content

8.0 Tuple parentheses optional in switch expression and statement #576

@BillWagner

Description

@BillWagner

When a tuple is used as the expression for a switch statement (or expression), the tuple doesn't need parentheses. For example:

void M(bool a, bool b)
{
    switch (a,b) // This is the tuple (a,b), but the parentheses are for the switch expression, not the tuple.
    {
        case (true, true):
            break;
        case (true, false):
            break;
        case (false, true):
            break;
        case (false, false):
            break;
            
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions