http://d.puremagic.com/issues/show_bug.cgi?id=11213
Summary: Simplify switch case-range statement
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-10-09
16:19:04 PDT ---
The current case-range syntax is rather awkward and verbose:
-----
import std.stdio;
void main()
{
foreach (x; 0 .. 10)
{
switch (x)
{
case 0: .. case 4:
writeln("a");
break;
case 5: .. case 9:
writeln("b");
break;
default:
}
}
}
-----
I suggest we allow the syntax "case 0 .. 4:", e.g.:
-----
switch (x)
{
case 0 .. 4:
writeln("a");
break;
case 5 .. 9:
writeln("b");
break;
default:
}
-----
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------