expression

bearophile bearophileHUGS at lycos.com
Sat May 30 04:53:26 PDT 2009


Frits van Bommel:
> To allow two expressions separated by a comma to be another expression. This is 
> only useful if the expression before the last comma has side-effects of course, 
> since its value isn't used. Such an expression returns the result of its 
> right-hand side.
> For example: (foo(), bar()) is an expression that calls foo(), then calls bar() 
> and evaluates to the return value of bar().
> This is mostly used in the increment clause of a for loop, like this:

Outside for loops is a bug-prone and not much useful feature. (In python the comma is more useful and safer).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list