Why does return 0 or break not work with the comma operator?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
40
down vote

favorite
4












I can write the code if(1) x++, y++; instead of if(1) x++; y++;, but in some cases it does not work (see below). It would be nice if you tell me about this.



int x = 5, y = 10; 
if (x == 5) x++, y++; // It works

if (x == 5) x++, return 0; // It shows an error


The same applies to for loops:



for (int i = 0; i < 1; i++) y++, y += 5; // It works

for (int i = 0; i < 1; i++) y++, break; // Does not work









share|improve this question



















  • 47




    You need to learn the difference between expressions and statements.
    – Some programmer dude
    Aug 21 at 6:40






  • 25




    Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
    – Some programmer dude
    Aug 21 at 6:42






  • 4




    Because that's not how the syntax for the comma operator is defined... and that's about it.
    – Lundin
    Aug 21 at 6:54






  • 5




    For the same reason that int i = break; does not work.
    – Peter A. Schneider
    Aug 21 at 15:09











  • Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
    – Nic Hartley
    Aug 21 at 20:23














up vote
40
down vote

favorite
4












I can write the code if(1) x++, y++; instead of if(1) x++; y++;, but in some cases it does not work (see below). It would be nice if you tell me about this.



int x = 5, y = 10; 
if (x == 5) x++, y++; // It works

if (x == 5) x++, return 0; // It shows an error


The same applies to for loops:



for (int i = 0; i < 1; i++) y++, y += 5; // It works

for (int i = 0; i < 1; i++) y++, break; // Does not work









share|improve this question



















  • 47




    You need to learn the difference between expressions and statements.
    – Some programmer dude
    Aug 21 at 6:40






  • 25




    Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
    – Some programmer dude
    Aug 21 at 6:42






  • 4




    Because that's not how the syntax for the comma operator is defined... and that's about it.
    – Lundin
    Aug 21 at 6:54






  • 5




    For the same reason that int i = break; does not work.
    – Peter A. Schneider
    Aug 21 at 15:09











  • Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
    – Nic Hartley
    Aug 21 at 20:23












up vote
40
down vote

favorite
4









up vote
40
down vote

favorite
4






4





I can write the code if(1) x++, y++; instead of if(1) x++; y++;, but in some cases it does not work (see below). It would be nice if you tell me about this.



int x = 5, y = 10; 
if (x == 5) x++, y++; // It works

if (x == 5) x++, return 0; // It shows an error


The same applies to for loops:



for (int i = 0; i < 1; i++) y++, y += 5; // It works

for (int i = 0; i < 1; i++) y++, break; // Does not work









share|improve this question















I can write the code if(1) x++, y++; instead of if(1) x++; y++;, but in some cases it does not work (see below). It would be nice if you tell me about this.



int x = 5, y = 10; 
if (x == 5) x++, y++; // It works

if (x == 5) x++, return 0; // It shows an error


The same applies to for loops:



for (int i = 0; i < 1; i++) y++, y += 5; // It works

for (int i = 0; i < 1; i++) y++, break; // Does not work






c++ c comma comma-operator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 21 at 15:03









Peter Mortensen

13k1983111




13k1983111










asked Aug 21 at 6:38









Nayem

32825




32825







  • 47




    You need to learn the difference between expressions and statements.
    – Some programmer dude
    Aug 21 at 6:40






  • 25




    Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
    – Some programmer dude
    Aug 21 at 6:42






  • 4




    Because that's not how the syntax for the comma operator is defined... and that's about it.
    – Lundin
    Aug 21 at 6:54






  • 5




    For the same reason that int i = break; does not work.
    – Peter A. Schneider
    Aug 21 at 15:09











  • Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
    – Nic Hartley
    Aug 21 at 20:23












  • 47




    You need to learn the difference between expressions and statements.
    – Some programmer dude
    Aug 21 at 6:40






  • 25




    Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
    – Some programmer dude
    Aug 21 at 6:42






  • 4




    Because that's not how the syntax for the comma operator is defined... and that's about it.
    – Lundin
    Aug 21 at 6:54






  • 5




    For the same reason that int i = break; does not work.
    – Peter A. Schneider
    Aug 21 at 15:09











  • Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
    – Nic Hartley
    Aug 21 at 20:23







47




47




You need to learn the difference between expressions and statements.
– Some programmer dude
Aug 21 at 6:40




You need to learn the difference between expressions and statements.
– Some programmer dude
Aug 21 at 6:40




25




25




Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
– Some programmer dude
Aug 21 at 6:42




Also note that using the comma expression the way that you do tend to make the code harder to read, understand and maintain.
– Some programmer dude
Aug 21 at 6:42




4




4




Because that's not how the syntax for the comma operator is defined... and that's about it.
– Lundin
Aug 21 at 6:54




Because that's not how the syntax for the comma operator is defined... and that's about it.
– Lundin
Aug 21 at 6:54




5




5




For the same reason that int i = break; does not work.
– Peter A. Schneider
Aug 21 at 15:09





For the same reason that int i = break; does not work.
– Peter A. Schneider
Aug 21 at 15:09













Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
– Nic Hartley
Aug 21 at 20:23




Why do you even want to do this? Just use braces. It's a lot clearer and simpler to understand.
– Nic Hartley
Aug 21 at 20:23












3 Answers
3






active

oldest

votes

















up vote
60
down vote













That's because return and break are statements, not expressions. As such, you cannot use it in another expression in any way. if and the others are similarly also statements.



What you can do however is rewrite your expression (for return) so that it's not nested in an expression - not that I recommend writing code like that:



return x++, 0;


You can't do that for break because it doesn't accept an expression.






share|improve this answer


















  • 31




    A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
    – Amadan
    Aug 21 at 6:47






  • 1




    @Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
    – Rakete1111
    Aug 21 at 6:49







  • 3




    @Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
    – Sebastian Redl
    Aug 21 at 7:56






  • 5




    @SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
    – Amadan
    Aug 21 at 8:05







  • 2




    BUT dont' do it please
    – edc65
    Aug 21 at 13:39

















up vote
11
down vote













The comma operator is for expressions.



The return statement and other pure statements are not expressions.






share|improve this answer






















  • And the conclusion?
    – Peter Mortensen
    Aug 21 at 15:03






  • 2




    @PeterMortensen I answered the "Why?" question, didn't I? What is your point?
    – Yunnosch
    Aug 21 at 15:48

















up vote
3
down vote













The comma operator is a binary operator that takes two values. In this way it is the same as + or *. Whereas + adds two values and returns the result, and * multiplies two values and returns the result, the comma operator simply ignores the value to the left and returns the value on the right.



2 + 5 has value 7



2 * 5 has value 10



2 , 5 has value 5, simply the operand to the right of the operator.



And so you can't write 2,break for the same reason that you can't write 2+break.
Because break is a statement, not a value.



What use is a binary operator that ignores one of its operands? The comma operator ignores the value of the left operand, but the expression is still evaluated.
Any side-effects of that expression are still realized. Consider:



i = 2;
j = 5;
i++, j++;


First the two expressions are evaluated. i++ returns the value 2, and then increments i. j++ returns the value 5, and then increments j. Finally the comma operator is applied to these two values: 2,5 which ignores the 2 and returns the 5.






share|improve this answer






















  • I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
    – Thomas Matthews
    Aug 21 at 18:42






  • 1




    Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
    – David Dubois
    Aug 21 at 19:23










Your Answer





StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51942943%2fwhy-does-return-0-or-break-not-work-with-the-comma-operator%23new-answer', 'question_page');

);

Post as a guest






























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
60
down vote













That's because return and break are statements, not expressions. As such, you cannot use it in another expression in any way. if and the others are similarly also statements.



What you can do however is rewrite your expression (for return) so that it's not nested in an expression - not that I recommend writing code like that:



return x++, 0;


You can't do that for break because it doesn't accept an expression.






share|improve this answer


















  • 31




    A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
    – Amadan
    Aug 21 at 6:47






  • 1




    @Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
    – Rakete1111
    Aug 21 at 6:49







  • 3




    @Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
    – Sebastian Redl
    Aug 21 at 7:56






  • 5




    @SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
    – Amadan
    Aug 21 at 8:05







  • 2




    BUT dont' do it please
    – edc65
    Aug 21 at 13:39














up vote
60
down vote













That's because return and break are statements, not expressions. As such, you cannot use it in another expression in any way. if and the others are similarly also statements.



What you can do however is rewrite your expression (for return) so that it's not nested in an expression - not that I recommend writing code like that:



return x++, 0;


You can't do that for break because it doesn't accept an expression.






share|improve this answer


















  • 31




    A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
    – Amadan
    Aug 21 at 6:47






  • 1




    @Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
    – Rakete1111
    Aug 21 at 6:49







  • 3




    @Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
    – Sebastian Redl
    Aug 21 at 7:56






  • 5




    @SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
    – Amadan
    Aug 21 at 8:05







  • 2




    BUT dont' do it please
    – edc65
    Aug 21 at 13:39












up vote
60
down vote










up vote
60
down vote









That's because return and break are statements, not expressions. As such, you cannot use it in another expression in any way. if and the others are similarly also statements.



What you can do however is rewrite your expression (for return) so that it's not nested in an expression - not that I recommend writing code like that:



return x++, 0;


You can't do that for break because it doesn't accept an expression.






share|improve this answer














That's because return and break are statements, not expressions. As such, you cannot use it in another expression in any way. if and the others are similarly also statements.



What you can do however is rewrite your expression (for return) so that it's not nested in an expression - not that I recommend writing code like that:



return x++, 0;


You can't do that for break because it doesn't accept an expression.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 21 at 13:05

























answered Aug 21 at 6:41









Rakete1111

32.6k975110




32.6k975110







  • 31




    A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
    – Amadan
    Aug 21 at 6:47






  • 1




    @Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
    – Rakete1111
    Aug 21 at 6:49







  • 3




    @Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
    – Sebastian Redl
    Aug 21 at 7:56






  • 5




    @SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
    – Amadan
    Aug 21 at 8:05







  • 2




    BUT dont' do it please
    – edc65
    Aug 21 at 13:39












  • 31




    A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
    – Amadan
    Aug 21 at 6:47






  • 1




    @Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
    – Rakete1111
    Aug 21 at 6:49







  • 3




    @Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
    – Sebastian Redl
    Aug 21 at 7:56






  • 5




    @SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
    – Amadan
    Aug 21 at 8:05







  • 2




    BUT dont' do it please
    – edc65
    Aug 21 at 13:39







31




31




A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
– Amadan
Aug 21 at 6:47




A nice illustration: there is no appreciable syntactic difference between x++ / 7 and x++, 7 (both / and , being operators). By the same token, x++, break makes as much sense as x++ / break: none at all.
– Amadan
Aug 21 at 6:47




1




1




@Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
– Rakete1111
Aug 21 at 6:49





@Amadan Nice illustration! I'm sure going to use it next time I have to explain this :) Thanks
– Rakete1111
Aug 21 at 6:49





3




3




@Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
– Sebastian Redl
Aug 21 at 7:56




@Amadan There's a highly significant difference (at least before C++17, not sure about the new rules): the comma operator induces a happens-before relationship (or in old terms, introduces a sequence point), which means that x++, x++ is defined, while x++ / x++ is undefined.
– Sebastian Redl
Aug 21 at 7:56




5




5




@SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
– Amadan
Aug 21 at 8:05





@SebastianRedl: There's also the fact that , returns the second operand, but / divides things, which I'd say is a slightly more significant difference :D . Syntactically though, the only thing that makes them different is precedence (simplified here, more realistic here).
– Amadan
Aug 21 at 8:05





2




2




BUT dont' do it please
– edc65
Aug 21 at 13:39




BUT dont' do it please
– edc65
Aug 21 at 13:39












up vote
11
down vote













The comma operator is for expressions.



The return statement and other pure statements are not expressions.






share|improve this answer






















  • And the conclusion?
    – Peter Mortensen
    Aug 21 at 15:03






  • 2




    @PeterMortensen I answered the "Why?" question, didn't I? What is your point?
    – Yunnosch
    Aug 21 at 15:48














up vote
11
down vote













The comma operator is for expressions.



The return statement and other pure statements are not expressions.






share|improve this answer






















  • And the conclusion?
    – Peter Mortensen
    Aug 21 at 15:03






  • 2




    @PeterMortensen I answered the "Why?" question, didn't I? What is your point?
    – Yunnosch
    Aug 21 at 15:48












up vote
11
down vote










up vote
11
down vote









The comma operator is for expressions.



The return statement and other pure statements are not expressions.






share|improve this answer














The comma operator is for expressions.



The return statement and other pure statements are not expressions.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 21 at 10:46









Konrad Rudolph

385k997591010




385k997591010










answered Aug 21 at 6:40









Yunnosch

10.8k51833




10.8k51833











  • And the conclusion?
    – Peter Mortensen
    Aug 21 at 15:03






  • 2




    @PeterMortensen I answered the "Why?" question, didn't I? What is your point?
    – Yunnosch
    Aug 21 at 15:48
















  • And the conclusion?
    – Peter Mortensen
    Aug 21 at 15:03






  • 2




    @PeterMortensen I answered the "Why?" question, didn't I? What is your point?
    – Yunnosch
    Aug 21 at 15:48















And the conclusion?
– Peter Mortensen
Aug 21 at 15:03




And the conclusion?
– Peter Mortensen
Aug 21 at 15:03




2




2




@PeterMortensen I answered the "Why?" question, didn't I? What is your point?
– Yunnosch
Aug 21 at 15:48




@PeterMortensen I answered the "Why?" question, didn't I? What is your point?
– Yunnosch
Aug 21 at 15:48










up vote
3
down vote













The comma operator is a binary operator that takes two values. In this way it is the same as + or *. Whereas + adds two values and returns the result, and * multiplies two values and returns the result, the comma operator simply ignores the value to the left and returns the value on the right.



2 + 5 has value 7



2 * 5 has value 10



2 , 5 has value 5, simply the operand to the right of the operator.



And so you can't write 2,break for the same reason that you can't write 2+break.
Because break is a statement, not a value.



What use is a binary operator that ignores one of its operands? The comma operator ignores the value of the left operand, but the expression is still evaluated.
Any side-effects of that expression are still realized. Consider:



i = 2;
j = 5;
i++, j++;


First the two expressions are evaluated. i++ returns the value 2, and then increments i. j++ returns the value 5, and then increments j. Finally the comma operator is applied to these two values: 2,5 which ignores the 2 and returns the 5.






share|improve this answer






















  • I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
    – Thomas Matthews
    Aug 21 at 18:42






  • 1




    Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
    – David Dubois
    Aug 21 at 19:23














up vote
3
down vote













The comma operator is a binary operator that takes two values. In this way it is the same as + or *. Whereas + adds two values and returns the result, and * multiplies two values and returns the result, the comma operator simply ignores the value to the left and returns the value on the right.



2 + 5 has value 7



2 * 5 has value 10



2 , 5 has value 5, simply the operand to the right of the operator.



And so you can't write 2,break for the same reason that you can't write 2+break.
Because break is a statement, not a value.



What use is a binary operator that ignores one of its operands? The comma operator ignores the value of the left operand, but the expression is still evaluated.
Any side-effects of that expression are still realized. Consider:



i = 2;
j = 5;
i++, j++;


First the two expressions are evaluated. i++ returns the value 2, and then increments i. j++ returns the value 5, and then increments j. Finally the comma operator is applied to these two values: 2,5 which ignores the 2 and returns the 5.






share|improve this answer






















  • I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
    – Thomas Matthews
    Aug 21 at 18:42






  • 1




    Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
    – David Dubois
    Aug 21 at 19:23












up vote
3
down vote










up vote
3
down vote









The comma operator is a binary operator that takes two values. In this way it is the same as + or *. Whereas + adds two values and returns the result, and * multiplies two values and returns the result, the comma operator simply ignores the value to the left and returns the value on the right.



2 + 5 has value 7



2 * 5 has value 10



2 , 5 has value 5, simply the operand to the right of the operator.



And so you can't write 2,break for the same reason that you can't write 2+break.
Because break is a statement, not a value.



What use is a binary operator that ignores one of its operands? The comma operator ignores the value of the left operand, but the expression is still evaluated.
Any side-effects of that expression are still realized. Consider:



i = 2;
j = 5;
i++, j++;


First the two expressions are evaluated. i++ returns the value 2, and then increments i. j++ returns the value 5, and then increments j. Finally the comma operator is applied to these two values: 2,5 which ignores the 2 and returns the 5.






share|improve this answer














The comma operator is a binary operator that takes two values. In this way it is the same as + or *. Whereas + adds two values and returns the result, and * multiplies two values and returns the result, the comma operator simply ignores the value to the left and returns the value on the right.



2 + 5 has value 7



2 * 5 has value 10



2 , 5 has value 5, simply the operand to the right of the operator.



And so you can't write 2,break for the same reason that you can't write 2+break.
Because break is a statement, not a value.



What use is a binary operator that ignores one of its operands? The comma operator ignores the value of the left operand, but the expression is still evaluated.
Any side-effects of that expression are still realized. Consider:



i = 2;
j = 5;
i++, j++;


First the two expressions are evaluated. i++ returns the value 2, and then increments i. j++ returns the value 5, and then increments j. Finally the comma operator is applied to these two values: 2,5 which ignores the 2 and returns the 5.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 21 at 18:54

























answered Aug 21 at 18:40









David Dubois

2,42111130




2,42111130











  • I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
    – Thomas Matthews
    Aug 21 at 18:42






  • 1




    Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
    – David Dubois
    Aug 21 at 19:23
















  • I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
    – Thomas Matthews
    Aug 21 at 18:42






  • 1




    Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
    – David Dubois
    Aug 21 at 19:23















I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
– Thomas Matthews
Aug 21 at 18:42




I don't think it ignores the value on the left, but actually evaluates the expression on the left and returns the expression on the right.
– Thomas Matthews
Aug 21 at 18:42




1




1




Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
– David Dubois
Aug 21 at 19:23




Yes, it evaluates the expression, ... and then ignores its value. I've edited to make it clearer. Thanks.
– David Dubois
Aug 21 at 19:23

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51942943%2fwhy-does-return-0-or-break-not-work-with-the-comma-operator%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay