Krupski:
"==" means "does it equal?""=" means "set this to that".
Example:
** X = 3;**
** if (X == 4) {**
** print ("It's not the same!"); <-- this gets printed because 3 is not equal to 4**
** } else {**
** print ("It matches!");**
** }**Now watch what happens here:
** X = 3;**
** if (X = 4) { <-- this SETS X to a value of 4**
** print ("It's not the same!");**
** } else {**
** print ("It matches!"); <-- this gets printed because setting X to anything returns boolean "true"**
** }**Make sense?
Eeeerm... I think you have the meaning of true and false mixed up.
What you probably meant is this:
X = 3;
if (X == 4) {
print ("It matches!");
} else {
print ("It's not the same!"); <-- this gets printed because 3 is not equal to 4
}
X = 3;
if (X = 4) { <-- this SETS X to a value of 4
print ("It matches!"); <-- this gets printed because setting X to anything non-zero returns boolean "true"
} else {
print ("It's not the same!");
}