SA-MP Forums Archive
About negation - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: About negation (/showthread.php?tid=114697)



About negation - UsaBoy91 - 20.12.2009

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])

?


Re: About negation - Donny_k - 20.12.2009

Edit:

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


Re: About negation - LarzI - 20.12.2009

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



Re: About negation - UsaBoy91 - 20.12.2009

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


Re: About negation - UsaBoy91 - 20.12.2009

So this is a blocked questioN ?


Re: About negation - Donny_k - 20.12.2009

It's been answered twice.

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


Re: About negation - Luka P. - 20.12.2009

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?


Re: About negation - LarzI - 20.12.2009

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


Re: About negation - UsaBoy91 - 20.12.2009

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

&& goes to || , and reverse


Re: About negation - LarzI - 20.12.2009

No it does not.