[Issue 24585] New: Allow switch with multiple arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 4 12:22:45 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24585
Issue ID: 24585
Summary: Allow switch with multiple arguments
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
Allow `switch` statements to have more than one argument: `switch (x, y)`.
Case labels then take the same number of arguments: `case (0, 0):`
The parentheses after `case` are then required.
A case label matches if it would match components individually.
While this should work for all types for which `switch` works, if the type of
the components’ sizes adds up to ≤ 64 bit, arguments can be connected into an
`ulong` (or smaller) and checked together.
--
More information about the Digitalmars-d-bugs
mailing list