No more fall through in case statement?
Robert DaSilva
sp.unit.262+digitalmars at gmail.com
Fri Jan 11 22:57:54 PST 2008
Michel Fortin wrote:
> On 2008-01-07 20:48:54 -0500, bearophile <bearophileHUGS at lycos.com> said:
>
>> In the Python community people collect use cases, do a simple
>> frequency count of them, and then usually look for a simple solution
>> able to cover most of them. So we can collect some use cases of the
>> switch. I presume most use cases are covered by a Pascal-like syntax.
>> The other situations are probably covered by putting commas between
>> alternative cases. What other use cases do you people have?
>
> A use case?
>
> I quite fancy GCC's extension which allows you to put ranges in case
> statements, for instance:
>
> switch (myChar) {
> case 'a'...'z':
> case 'A'...'Z':
> case '0'...'9':
> // do something.
> }
>
> I think D should have it too. (Also, since we're at it, it's covered by
> Pascal.)
>
Yes, but it would be 'A' .. 'Z' not 'A' ... 'Z'.
More information about the Digitalmars-d
mailing list