So by my teacher we were tasked to make a triangle guesser or something close to that, but I have no clue what a boolean is because I had missed that day, so could someone try to explain what a boolean is?
A boolean is just true or false.
ego-lay_atman-bay is right:just true or false.
But keep in mind:
that was just general coding - a google search would suffice. Look at the first result.
It’s like true or false, or 0 or 1. Booleans are a major function in logic and everything runs on Boolean. Binary is a good example of this - every bit is either on or off to create a number from 1 to… well, whatever the limit is.
tethrarxitet is right, it is a 0/1. but be wary of AND, OR, And NOT.
- A usual Boolean stores a 1 for ON and 0 for OFF. that’s the basis. we know that.
- An AND Boolean checks if both the first and second Boolean are a 1, then emits an ON. (for example, 0-0, 0-1, and 1-0 are all lacking both being a 1, so it emits OFF. meanwhile, both are 1’s in a case of 1-1, so then it emits ON.)
- An OR Boolean checks if either the first or second Boolean are a 1, then emits an ON. (for example, a 0-0 has neither being a 1, so it emits an OFF. but in the cases of 0-1, 1-0, and 1-1, either one or both of the two emit a 1, so it emits an ON.
- now for NOT. NOT gates are switcheroos. if it sees an ON, it makes it an OFF. it sees an OFF, it makes it an ON.
- MINI EXPLINATION ZONE:
- by putting an AND in a NOT, you get a XAND.
- by putting an OR in a NOT, you get a XOR.
- by putting an AND in one of the slots of an AND, you get a THREE WAY AND (TWA).
- in Boolean land, its all 1’s and 0’s. no 2’s.
i just felt the urge to explain this, and i might make a project on it.
adhd go brr.
You can also set a variable to a Boolean:
![]()
if either the first or second Boolean are is a 1
you get a XAND NAND
Isn’t XOR literally just “OR AND (NOT AND)”? Meaning:
TRUE ⊻ = FALSETRUE
⊻ FALSETRUE = TRUE
TRUE ⊻ TRUE = FALSE
⊻ FALSE = FALSEFALSE
NOT OR would be NOR, which is another different thing.
Thank you, tethraxitet!
wait XOR is OR AND? i thought it was OR (OR) → XOR (NOT OR). so its NOR and NAND, not XOR and XAND. got it.
Not quite - it’s OR AND (NOT AND), where 1 and 2 will return true if one is on [OR], and [AND] if both are on or off, it will return false [NOT AND].
If that doesn’t help much, let me show a block example:
<<<case 1> or <case 2> @<:> > and <not <<case 1> and <case 2> @<:> > > @<:> >
so is it NOR or XOR or both?
NOR is Not OR
NAND is Not AND
XOR is eXclusive OR (either one excluding the other; OR excluding the case of both)
XNOR is eXclusive NOR (both or neither)
<not <(a) or (b)>> // a nor b <not <(a) and (b)>> // a nand b <<(a) and <not (b)>> or <<not (a)> and (b)>> // a xor b <<(a) or (b)> and <not <(a) and (b)>>> // a xor b <not <(a) xor (b) :: operators>> // a xnor b <<(a) and (b)> or <not <(a) or (b)>>> // a xnor b
So it’s the same as = ?
Yes, in the domain of boolean