'in' for arrays?
Hasan Aljudy
hasan.aljudy at gmail.com
Wed Dec 6 14:24:22 PST 2006
Alexander Panek wrote:
> Lionello Lunesu wrote:
>> Alexander Panek wrote:
>>> Lionello Lunesu wrote:
>>>> switch(val) {
>>>> case "off","disable","no":
>>>> // code here
>>>> default:
>>>> break;
>>>> }
>>> May I ask in what way this is different from:
>>>
>>> switch ( val ) {
>>> case "off":
>>> case "disable":
>>> case "no":
>>> // code here
>>> break;
>>> }
>>
>> case x,y: is the same as case x: case y:
>> Apart from that, if you don't provide a 'default' statement, D inserts
>> one with assert(0), meaning that your code would trip if val were
>> anything other than those 3 mentioned cases.
>>
>> L.
>
> Yea..I've seen that I forgot the default: break; after replying.. :P
And you're very likely to forget it when writing code ..
More information about the Digitalmars-d
mailing list