Killing the comma operator
Gopan via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 11 06:29:56 PDT 2016
On Tuesday, 10 May 2016 at 09:52:07 UTC, Mathias Lang wrote:
>
> Do you like comma expressions, ...
I am a student.
In C, one scenario where I like comma is this.
int x;
while( scanf("%d", &x), x!= 0) // until user input 0.
{
//do something with x
}
Without the comma operator, I would have to repeat the scanf
statement.
int x;
scanf("%d", &x);
while(x != 0)
{
//do something with x
scanf("%d", &x);
}
Does anybody think that this is a useful case of comma operator?
More information about the Digitalmars-d
mailing list