Wikia

FiM++ Community Wiki

Changes: Exclusive or

Edit

Back to page

m (Example: derp)
(truth table)
Line 1: Line 1:
The '''exclusive or''' (or '''either or''') operator is a [[Boolean Operators|boolean operator]] which returns {{tag|literal|true}} only if the number of true arguments is odd, else returns {{tag|literal|false}}.
+
The '''exclusive or''' (or '''either or''') operator is a [[Boolean operator]] which returns {{code|literal|true}} if and only if the number of true arguments is odd, else returns {{code|literal|false}}.
   
 
Its token is named '''EXCLUSIVE_OR'''.
 
Its token is named '''EXCLUSIVE_OR'''.
   
== [[FDS]] ==
+
== Truth Table ==
  +
{|class="wikitable" style="text-align:center;"
  +
|+2 Inputs
  +
!colspan=2|Inputs
  +
!rowspan=2|Output
  +
|-
  +
!A!!B
  +
|-
  +
|T||T
  +
|F
  +
|-
  +
|T||F
  +
|T
  +
|-
  +
|F||T
  +
|T
  +
|-
  +
|F||F
  +
|F
  +
|}
   
  +
== [[FDS]] ==
 
{{See Also/small|Prefix notation}}
 
{{See Also/small|Prefix notation}}
   
{{codeblock|{{code|operator|either}}{{tag|whitespace}}{{code|value|<value:'''boolean'''>}}{{tag|whitespace}}{{code|operator|or}}{{tag|whitespace}}{{code|value|<value:'''number'''>}}}}
+
{{codeblock|{{code|operator|either}}{{tag|whitespace}}{{tag|value|Boolean}}{{tag|whitespace}}{{code|operator|or}}{{tag|whitespace}}{{tag|value|Boolean}}}}
   
 
=== Example ===
 
=== Example ===
 
 
{{codeblock|{{code|keyword|I did this as long as}}{{code|whitespace| }}{{code|operator|either}}{{code|whitespace| }}{{code|variable|Applejack}}{{code|whitespace| }}{{code|operator|is}}{{code|whitespace| }}{{code|literal|23}}{{code|whitespace| }}{{code|operator|or}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code|operator|is}}{{code|whitespace| }}{{code|literal|92}}{{code|punctuation|:}}
 
{{codeblock|{{code|keyword|I did this as long as}}{{code|whitespace| }}{{code|operator|either}}{{code|whitespace| }}{{code|variable|Applejack}}{{code|whitespace| }}{{code|operator|is}}{{code|whitespace| }}{{code|literal|23}}{{code|whitespace| }}{{code|operator|or}}{{code|whitespace| }}{{code|variable|Spike}}{{code|whitespace| }}{{code|operator|is}}{{code|whitespace| }}{{code|literal|92}}{{code|punctuation|:}}
   
Line 25: Line 25:
 
*[[Operators]]
 
*[[Operators]]
   
{{stub}}
 
 
{{Navbox/Phrases}}
 
{{Navbox/Phrases}}
  +
{{stub}}

Revision as of 01:21, November 20, 2012

The exclusive or (or either or) operator is a Boolean operator which returns true if and only if the number of true arguments is odd, else returns false.

Its token is named EXCLUSIVE_OR.

Truth Table

2 Inputs
Inputs Output
AB
TT F
TF T
FT T
FF F

FDS

Icon Info
See Also: Prefix notation

Example

I did this as long as either Applejack is 23 or Spike is 92: ...

This loops the next part of code if either the variable Applejack is equal to 23 or the variable Spike is equal to 92.

This is equivalent to the following Java code:

while(Applejack==23^Spike==92) { ...

See Also


Icon Info
This article is a stub. You can help FiM++ Wiki by expanding it.

Around Wikia's network

Random Wiki