ultek said:int var1 = var2 | var2;
Well, you wouldn't normally call && conditional "and" and || conditional "or", they're normally referred to as logical "and" and logical "or" respectively. The only operator that would be referred to using the word conditional, would be the conditional operator, ?:David said:Additional information--
AND, OR, etc are either bit-wise or logical operators. Expressions that evaluate to true or false are evaluated on that basis. It is this use that you will see most often in scripting for RunUO for example.
"&&" is actually a "conditional AND" which only evaluates the second or subsequent operand if it is necessary.
In an AND operation both operands must be true in order for the result to be true. If the first operand evaluates to false the result must be false. A regular AND will continue to evaluate the second operand while a conditional AND will skip it since the result is already known.
The "conditional OR" or "||" is similiar except that it only evaluates the second operand if the first is false.
I belive (though I could be wrong here) that the conditional operators only perform the logical comparison. It seems to me that there would be no use for them in a bit-wise comparison since you would always want the second operand evaluated in that usage.
int var1 = var2 | var3;
Sep102 said:Well, you wouldn't normally call && conditional "and" and || conditional "or", they're normally referred to as logical "and" and logical "or" respectively. The only operator that would be referred to using the word conditional, would be the conditional operator, ?:
The logical operators perform only a logical test on the operands after they are evaluated and do no type of bitwise operations, that is, they do only do a logical test of the operand to see if it's true or false, rather than bitwise ANDing or ORing a value with another. However they could of course be used to logically test the results of two bitwise operations.
Oh, and in case anyone is wondering, the concept of evaluating only the first operand if the first is false in a logical "and" or if the first is true in a logical "or" is called short-circuit, minimal or lazy evaluation.