Skip to content

Support multiple case labels (like JS/TS switch-case style) #3094

@kugesan1105

Description

@kugesan1105

Currently, our pattern matching supports the | (OR) operator for combining multiple patterns, e.g.:

case [1, 2] | [3, 4]:
    print("Matched either [1, 2] or [3, 4].")

However, it would be more readable and natural to allow multiple case labels like in JavaScript or TypeScript, for example:

case [1, 2]:
case [3, 4]:
    print("Matched either [1, 2] or [3, 4].")

This style improves visual clarity, especially when handling longer or more descriptive cases, and aligns with familiar syntax from other popular languages.

Image

Metadata

Metadata

Assignees

Labels

new feature/enhancementProposing a new feature or enhancement to existing feature.

Projects

Status

Changes Requested

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions