About negation
#1

If i do something like this

pawn Код:
new var[2] = 1;

if(var[0] && var[1]) // code here
else // code
What will be the negation of if(var && var) ( else ) ?

1. if(!var[0] && var[1])
2. if(!var[0] && var[1])
3. if(!var[0] || var[1])
4. if(!var[0] || !var[1])

?
Reply
#2

Edit:

4, it's if either one isn't true as you are checking if they are both true.
Reply
#3

Uhm, can't you do
pawn Код:
if( !( var && var ))
Reply
#4

You didn't understand me. I know that , but if i use ELSE , what he will choose ?
Reply
#5

So this is a blocked questioN ?
Reply
#6

It's been answered twice.

If we don't understand you then revise your question dude, we can only answer the questions you ask.
Reply
#7

Revise your question
You cannot do

if(!var[0] && var[1])
and then
if(!var[0] || var[1])

No sense, you want to check both, or just one of them?
Reply
#8

Quote:
Originally Posted by Angel φ
You didn't understand me. I know that , but if i use ELSE , what he will choose ?
if( var && var2 ) //both are equal to true
something
else //both are equal to false
something

That's what you wanted to know, right?

If you'd use
if( var || var2 ) //var OR var 2 are equal to true
something
else //neither var OR var 2 are equal to true (both are equal to false)
something

That would happen
Reply
#9

Yea thanks. I though he change the OPERATORS too , something like at math ...

&& goes to || , and reverse
Reply
#10

No it does not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)