Case Range Statement ..

Walter Bright newshound1 at digitalmars.com
Tue Jul 7 20:37:06 PDT 2009


Nick Sabalausky wrote:
> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
>> It's handy when you want to prefix one expression to another, as in:
>>
>>    (foo(), x + 3)
>>
> 
> I guess I'm not familiar with that syntax. What does that do and for what 
> purpose? 

They're called Comma Expressions, and the left operand is evaluated 
first, its result discarded, then the right operand is evaluated and 
forms the type and result of the Comma Expression.

It's handy for things like rewriting ++e so it can be used more than 
once but is only evaluated once:

    (tmp = ++e, tmp)



More information about the Digitalmars-d mailing list