Bill Baxter:
> Switch is a monstrosity pretty much any way you look at it.  Sh had the right
> idea there.  Is "case" really necessary there?  Some syntax should
> suffice I would thing.  And "default" is probably the world's most
> useless keyword.  Why not "else:" or "*:" instead of introducing a
> whole new keyword?

Case of Pascal is better (2 keywords where "of" isn't that useful, begin-end 
are optional if you want more than one instruction, Pascal isn't 
case-sensitive):

Case X of
  1: Begin
        ...
      End;
  2 .. 10: Begin
        ...
      End;
  ...
  Else Begin
         ...
       End;
End; {CASE}

But D is backward compatible with C (unlike languages like Scala, that 
eventually D will need to take a look at), so this is an academic topic.

Bye,
bearophile

Reply via email to