Case Range Statement ..

Derek Parnell derek at psych.ward
Tue Jul 7 15:27:47 PDT 2009


On Tue, 07 Jul 2009 12:38:49 -0700, Walter Bright wrote:

> Nick Sabalausky wrote:
>>  Someone else said it's also an expression
>> that evaluates to 3, but that seems beyond useless to me. 
> 
> It's handy when you want to prefix one expression to another, as in:
> 
>     (foo(), x + 3)

I took what Nick said to mean that expressions in the form 

   ( integerA , integerB )

were useless as they always evaluate to integerB, so why bother to code
them as expressions. Whereas such an expression *in* the context of a case
clause could be made to mean that an inclusive range was being requested by
the coder.

Walter's example, using a function call, could be useful as the function
can have side-effects that influence the next sub-expression "x + 3".

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list