Boolean expressions are stuff like 5>8 and stuff of the like, correct? I'm pretty sure that they're used a lot in loops, but are they used in any other functions?
Boolean expressions
Started by Sionofdarkness, Jul 29 2006 12:54 PM
11 replies to this topic
#1
Posted 29 July 2006 - 12:54 PM
|
|
|
#2
Posted 29 July 2006 - 01:40 PM
A boolean expression is an expression that evaluates to True or False. They are primarily used in loop tests and if statements.
In C++, you also have bitwise logical operators that treat 1 as True and 0 as False. By using these operators on unsigned char, you can easily do things like IP masking. Boolean expressions also show up a LOT in electronics, in things called logic gates. Those are what actually make all of our computers work.
In C++, you also have bitwise logical operators that treat 1 as True and 0 as False. By using these operators on unsigned char, you can easily do things like IP masking. Boolean expressions also show up a LOT in electronics, in things called logic gates. Those are what actually make all of our computers work.
#3
Posted 29 July 2006 - 02:59 PM
loops and if statements are conditional
the condition is a boolean statement
so 5>8 would evaluate false
and false is, of course, a boolean value
some programming languages allow either true/false or 1/0
the condition is a boolean statement
so 5>8 would evaluate false
and false is, of course, a boolean value
some programming languages allow either true/false or 1/0
#4
Posted 29 July 2006 - 03:27 PM
Oh yeah, now it's all coming back to me, I used to know some stuff about this but I'd forgotten. What's the thing called with the AND/OR/XOR stuff?
#5
Posted 29 July 2006 - 03:32 PM
logic...?
#6
Guest_NeedHelp_*
Posted 30 July 2006 - 06:52 AM
Guest_NeedHelp_*
They are used in conditional statements like 5>x OR x>10
#7
Posted 30 July 2006 - 12:01 PM
AND returns true only if both operands are true.
OR returns true if at least one operand is true.
XOR returns true if the operands are different.
NOT returns the opposite of its operand.
OR returns true if at least one operand is true.
XOR returns true if the operands are different.
NOT returns the opposite of its operand.
#8
Posted 31 July 2006 - 04:51 PM
XOR returns FALSE if both operands are 0. XOR is basically, "if one or the other, but not both".
#9
Posted 31 July 2006 - 04:57 PM
#10
Guest_Kaabi_*
Posted 01 August 2006 - 09:18 AM
Guest_Kaabi_*
Oh! XOR is basically the exclusive or, and the regular OR is the inclusive OR, I learned that back in geometry. Interesting...
#11
Posted 01 August 2006 - 04:10 PM
#12
Posted 02 August 2006 - 04:25 PM
That XOR thing makes sense, because XOR is the inclusive, and X is a symbol for deleting something, so it deletes the AND and makes it inclusive... I know that's a bit convoluted (I like using that word), but you know what I mean.


Sign In
Create Account


Back to top









