No more fall through in case statement?

Michel Fortin michel.fortin at michelf.com
Fri Jan 11 20:08:47 PST 2008


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.)

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list