DEV Community

Discussion on: Know more about if(x=y)

Collapse
 
hardikchopra profile image
Hardik Chopra

I think in the condition box, we should always use == and never use = intentionally.

Collapse
 
ritvikdubey27 profile image
Ritvik Dubey

Yeah he is right we should not use = intentionally. This article was just for information.

Collapse
 
pgradot profile image
Pierre Gradot

Never.

With g++, you get a warning with -Wall. See online.

warning: suggest parentheses around assignment used as truth value [-Wparentheses]