Actually, neither = nor == are expressions. The first is an assignment operator, and the second is a comparison operator. The expression is what is supposed to appear within the parenthesis.
if(something = somethingelse) does not work because something = somethingelse is an assignment.
if(something == somethingelse) works because something == somethingelse is an expression.
This brings up a question. It isn't because I need it or anything, im just curious.
I know this works in C:
int a,b,c,d
if((a=b+c)==d)
Why doesn't it work in DM?
Alathon
Actually, neither = nor == are expressions. The first is an assignment operator, and the second is a comparison operator. The expression is what is supposed to appear within the parenthesis.
if(something = somethingelse) does not work because something = somethingelse is an assignment.
if(something == somethingelse) works because something == somethingelse is an expression.