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:44 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inclusive OR? Wtf?
#3
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.

I don't see the problem. I'm more experienced in programming logic and OR's usage is quite necessary, so lemme give you an example.


Let's say on a social networking site, I want the login/user system to distinguish Admins and Moderators from normal users, so as to allow entry to certain parts of the site only for the Admins and Mods. Well, one easy way I could do this is to only allow entry to the site if the user's row in the database has its user type set to either "admin" or "mod":

Quote:<?php

$usertype = $row['usertype'];

if($usertype === 'admin' || 'mod'){
// Do shit
}
else{ header('Location: home.php'); } // kick 'em to another file

?>

Using OR here allows me to set the parameters which to check for, though it's not the only.
"The reason things will never get better is because people keep electing these rich cocksuckers who don't give a shit about you."
-George Carlin
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)