XOR (boolean): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{KW|XOR (boolean)|XOR}} evaluates two conditions and if either of them is True then it returns True, if both of them are True then it returns False, if both of them are False then it returns False. {{PageSyntax}} :<code>{{Parameter|condition}} {{KW|XOR (boolean)|XOR}} {{Parameter|condition2}}</code> {{PageDescription}} * Either {{Parameter|condition}} or {{Parameter|condition2}} must be True for the evaluation to return True. * It is called '''"exclusive OR"''' beca...")
 
No edit summary
Line 3: Line 3:


{{PageSyntax}}
{{PageSyntax}}
:<code>{{Parameter|condition}} {{KW|XOR (boolean)|XOR}} {{Parameter|condition2}}</code>
: {{Parameter|condition}} {{KW|XOR (boolean)|XOR}} {{Parameter|condition2}}





Revision as of 22:06, 27 November 2022

Template:KW evaluates two conditions and if either of them is True then it returns True, if both of them are True then it returns False, if both of them are False then it returns False.


Syntax

condition Template:KW condition2


Description

  • Either condition or condition2 must be True for the evaluation to return True.
  • It is called "exclusive OR" because the conditions cannot both be True for it to return True like the Template:KW evaluation.
  • condition and condition2 can themselves contain XOR evaluations.


Template:RelationalTable


Examples

Example: Dilemma...


True = NOT False
AndersWon = True
PeterWon = True
IF AndersWon = True XOR PeterWon = True THEN
PRINT "Thank you for your honesty!"
ELSE
PRINT "You can't both have won (or lost)!"
END IF

You can't both have won (or lost)!


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link