#1

Has pawn something like a pascal xor?

Like this:

pawn Код:
if(a = b xor c = d) then ...
pawn Код:
true xor true = false
true xor false = true
false xor true = true
false xor false = false
Reply
#2

There is only bitwise XOR which is '^' but only works with integers. However, it must be noted that in Pawn && and || do not evaluate any further expressions if the result of the expression has already been determined. For example:

pawn Код:
if(e1 = true || e2 = false) // will not evaluate e2, result: true
if(e1 = false || e2 = true) // will evaluate both expression, result: true

if(e1 = true && e2 = true) // will evaluate both expression, result: true
if(e1 = false && e2 = true) // will not evaluate e2, result: false
Edit: I think it may be solved with this construct:
pawn Код:
if((e1 && !e2) || (e2 && !e1))
Reply
#3

Thanks for the advice.
If I have for example 5 conditions where must be met only once. I'll die before he could write complicated way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)