Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: February 5, 2025, 11:50 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inclusive OR? Wtf?
#4
RE: Inclusive OR? Wtf?
(May 29, 2014 at 1:06 pm)Tea Earl Grey Hot Wrote: I'm studying propositional logic and I learned that "or" means "at least one is true". So you could have "a or b" and even if both a and b were each true then "a or b" is still true. In everyday language however "or" means only one of two things can be true, not both hence the reason we have the phrase "and/or" to mean "at least one is true".

Why not just keep the traditional exclusive meaning of "or" in propositional logic and then have another symbol for "and/or"? Seems simpler to me.

It greatly simplifies things to have two different operators for OR and XOR. Otherwise, the nonexclusive OR would have to be written as " if (a or b) or (a and b)". In my experience, the nonexclusive OR is much more commonly used.

In computer languages, the lack of a non-exclusive or would also make some operations less optimal - something like:

if (null == s || s.equals("")) {
// some operation
}


Would be extremely cumbersome to write as a single check. You'd have to do something like this to make it's meaning apparent:

if (null == s) {
// some operation
} else if s.equals("") {
// same operation
}

There's no straightforward way to code it using a nonexclusive or without the code throwing a null pointer exception.
Reply



Messages In This Thread
Inclusive OR? Wtf? - by Tea Earl Grey Hot - May 29, 2014 at 1:06 pm
RE: Inclusive OR? Wtf? - by bennyboy - May 29, 2014 at 1:18 pm
RE: Inclusive OR? Wtf? - by hppavilion - June 4, 2014 at 4:50 am
RE: Inclusive OR? Wtf? - by MindForgedManacle - May 29, 2014 at 1:52 pm
RE: Inclusive OR? Wtf? - by Jackalope - May 29, 2014 at 2:05 pm
RE: Inclusive OR? Wtf? - by Tea Earl Grey Hot - May 29, 2014 at 2:11 pm
RE: Inclusive OR? Wtf? - by Jackalope - May 29, 2014 at 2:17 pm
RE: Inclusive OR? Wtf? - by Angrboda - June 4, 2014 at 3:24 pm
RE: Inclusive OR? Wtf? - by bennyboy - June 6, 2014 at 4:06 am



Users browsing this thread: 1 Guest(s)