> I have never seen an if statement do this "if (x = y >= z)". I will bet x = y is an assignment and has the value of y x == y is a comparison and has a value of 1 or 0 if I say if(x == y == z) then because x == y can be either 1 or 0, z has to be either 1 or 0 to be true. x == y is evaluated first and has a value of either 1 or 0, then it is compared to z, if x == y is true, then if z is 1, the whole statement is true. if x == y is falue, then if z is 0, the whole statement is true. But, that is not what he is doing here. if(x = y >= z) is an abbreviation of: x = y if(x >= z) remember, an assignment has a value, and it has the value of the statement on the right-side of the assignment. be careful about == versus = > if you change that, you will get some better results. > If someone knows that this can be done or show me an application that > does this, I would like to see it or understand what it is actually > trying to compare. seems like your better off doing x = y && x >= z or > x = y && y >= z > its comparing num_ships = GetX() to see if it is greater than or equal to something else. num_ships = GetX() has the value of GetX() It would be so much easier to understand if this statement where just written seperatly x = y if(x >= z) if compiles to exactly the same thing! and is much easier to read, and doesn't confuse people. This is why I never combine statements like this. +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST