It's the comma operator, also known as the "evaluate and forget" operator. The effect of a, b
is:
- Evaluate
a
, including any side effects
- Discard its value (i.e. do nothing with it)
- Evaluate
b
- Use the result of
b
as the result of the entire expression a, b
The author of the loop wanted to express the following:
Read command
from cin
, and then enter the loop body unless command
is equal to "END"
However, they would have been better off using &&
instead of ,
here, because cin >> command
can fail (i.e. if the end of input is reached before the word END
is found). In such case, the condition with ,
will not do what was intended (it will likely loop forever, as command
will never receive the value END
), while the condition with &&
would do the right thing (terminate).