switch ( Expression ) ScopeStatement

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Jul 6 18:00:16 PDT 2009


On Mon, Jul 6, 2009 at 8:18 PM, Derek Parnell<derek at psych.ward> wrote:
> I see that the syntax for 'switch' is ...
>
>   switch ( Expression ) ScopeStatement
>
> and ScopeStatement is either a BlockStatement or a NonEmptyStatement.
>
> Meaning that
>
>  switch (i) j = k;
>
> is valid syntax! Why is that?

So you can write this, of course!

switch(x) case 1: break;

I mean, you sometimes need a one-case switch, yes?  ;)


More information about the Digitalmars-d-learn mailing list