Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Boolean expressions

  1. #1
    Sionofdarkness is offline Programming Expert
    Join Date
    Jul 2006
    Posts
    383
    Rep Power
    0

    Boolean expressions

    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?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    icepack's Avatar
    icepack is offline Programmer
    Join Date
    Jul 2006
    Location
    North Carolina
    Posts
    115
    Rep Power
    21
    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

  5. #4
    Sionofdarkness is offline Programming Expert
    Join Date
    Jul 2006
    Posts
    383
    Rep Power
    0
    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?

  6. #5
    icepack's Avatar
    icepack is offline Programmer
    Join Date
    Jul 2006
    Location
    North Carolina
    Posts
    115
    Rep Power
    21
    logic...?

  7. #6
    NeedHelp Guest
    They are used in conditional statements like 5>x OR x>10

  8. #7
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    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.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  9. #8
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    XOR returns FALSE if both operands are 0. XOR is basically, "if one or the other, but not both".

  10. #9
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    1 Xor 1 = 0
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  11. #10
    Kaabi Guest
    Oh! XOR is basically the exclusive or, and the regular OR is the inclusive OR, I learned that back in geometry. Interesting...

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. tedit boolean value
    By jaiii in forum C and C++
    Replies: 12
    Last Post: 07-31-2010, 02:48 PM
  2. Boolean Validation in regards to $_
    By inenigma in forum Perl
    Replies: 2
    Last Post: 04-07-2010, 02:55 AM
  3. Boolean Operators
    By chili5 in forum Java Tutorials
    Replies: 10
    Last Post: 01-13-2010, 03:31 PM
  4. C++ Boolean s
    By b3hr0uz in forum C and C++
    Replies: 5
    Last Post: 04-30-2009, 07:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts