• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Computer Logic - (1 && !(0 || 1)) How does this equate 0?

Status
Not open for further replies.
I'm sorry this is C++ and I figured it was close enough to Jass that someone would understand, I'm trying to learn C++ but the question they gave me was: Evaluate: !(1 && !(0 || 1))
A. True
B. False

And the answer ended up being True.
But for it to be true, !(1 && !(0 || 1)) would have to end up being !0.
0 = False, 1 = True.
Very confusing.
 
Ok so 1 && False is False.
And False || True is True?

Thanks, that's all I needed to know.


That is pretty basic logic, yes.

True OR False = True
--because it is asking if either one is true

True AND False = False
--because it is asking if BOTH are true


Dr. Super: This kind of logic applies to programming logic in general, what is the problem with someone asking?
 
Can anyone break it down, i'm sure theres some little detail i'm missing..
(1 && !(0 || 1)) = 0 = False?

But how?

I can't make sense of how the first 1 somehow become 0.
Thanks.

Remember to start with the most nested quotes.

(1 && !(0 || 1))

False OR True is TRUE.

Right outside the parenthesis is NOT (think like the distributive property). NOT TRUE is False.

So now we have 1 && FALSE

TRUE && FALSE requires that both statements are true to return true; since they aren't, the answer is FALSE.

Hope that helped.
 
Status
Not open for further replies.
Back
Top