<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Template%3AIfequal%2Fdoc</id>
	<title>Template:Ifequal/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Template%3AIfequal%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Template:Ifequal/doc&amp;action=history"/>
	<updated>2026-04-08T07:06:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Template:Ifequal/doc&amp;diff=14190&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;{{Documentation subpage}}  This template is used to extend the parser function Wikipedia:Help:Conditional expressions|&lt;code&gt;#ifeq:&lt;/cod...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Template:Ifequal/doc&amp;diff=14190&amp;oldid=prev"/>
		<updated>2020-10-26T16:04:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Documentation subpage}}  This template is used to extend the &lt;a href=&quot;https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions&quot; class=&quot;extiw&quot; title=&quot;mw:Help:Extension:ParserFunctions&quot;&gt;parser function&lt;/a&gt; Wikipedia:Help:Conditional expressions|&amp;lt;code&amp;gt;#ifeq:&amp;lt;/cod...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
&lt;br /&gt;
This template is used to extend the [[mw:Help:Extension:ParserFunctions|parser function]] [[Wikipedia:Help:Conditional expressions|&amp;lt;code&amp;gt;#ifeq:&amp;lt;/code&amp;gt;]] to multiple tests.&lt;br /&gt;
&lt;br /&gt;
The template takes up to eight pairs of arguments (i.e., 16 [[Wikipedia:Help:Template#Handling parameters|unnamed parameters]]), tests the odd versus the even parameter values, and returns a TRUE value (a string of characters) if &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; pair matches using the parser function &amp;lt;code&amp;gt;#ifeq:&amp;lt;/code&amp;gt;, otherwise it returns a FALSE value (an [[Wikipedia:empty string|empty string]]).&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|foo}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|foo}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|bar}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|bar}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|foo|bar|bar}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|foo|bar|bar}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|foo|bar|buzz}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|foo|bar|buzz}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|bar|buzz|buzz}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|bar|buzz|buzz}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|foo|bar|buzz|bat}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|foo|bar|buzz|bat}}&lt;br /&gt;
&lt;br /&gt;
The returned values are suitable for testing within simple if-then-else conditionals inside the calling template.&lt;br /&gt;
&lt;br /&gt;
===Typical example===&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{{#if:&amp;lt;/nowiki&amp;gt; &amp;#039;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;{{ifequal&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;#039;|{{{1}}}|one|{{{2}}}|two|{{{3}}}|three&amp;#039;&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&amp;#039; | Yes, we | No, we don&amp;#039;t &amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt; have a match.&lt;br /&gt;
&lt;br /&gt;
Assuming this code is inside of a template that can be called with three unnamed parameter values:&lt;br /&gt;
* The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; call returns TRUE if the first unnamed parameter has the value &amp;quot;one&amp;quot; OR the second has the value &amp;quot;two&amp;quot; OR the third has the value &amp;quot;three&amp;quot;, in which case the code will build the string: &amp;quot;Yes, we have a match.&amp;quot;&lt;br /&gt;
* The &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; call returns FALSE if none match, in which case it will build the string: &amp;quot;No, we don&amp;#039;t have a match.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===OR detection ===&lt;br /&gt;
#An equality: &amp;lt;nowiki&amp;gt; {{#if:{{ifequal|1|2|3|4|6|6}}|True|False}} &amp;lt;/nowiki&amp;gt; -- &amp;#039;&amp;#039;&amp;#039;[{{#if:{{ifequal|1|2|3|4|6|6}}|True|False}}]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
#An equality, where &amp;lt;nowiki&amp;gt;{{{1}}}&amp;lt;/nowiki&amp;gt; is an example variable: &amp;lt;nowiki&amp;gt; {{#if:{{ifequal|{{{1}}}|1|{{{1}}}|2|{{{1}}}3|{{{1}}}|4|{{{1}}}|5}}|True|False}} &amp;lt;/nowiki&amp;gt; -- &amp;#039;&amp;#039;&amp;#039;[True]&amp;#039;&amp;#039;&amp;#039; when the variable value is 1, 2, 3, 4 or 5. &amp;#039;&amp;#039;&amp;#039;[False]&amp;#039;&amp;#039;&amp;#039; when is any another value.&lt;br /&gt;
#Inequality: &amp;lt;nowiki&amp;gt; {{{{#if:ifequal|1|2|3|4|5|6}}|True|False}} &amp;lt;/nowiki&amp;gt; -- &amp;#039;&amp;#039;&amp;#039;[{{#if:{{ifequal|1|2|3|4|5|6}}|True|False}}]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===Behavior with empty strings (unset parameter values)===&lt;br /&gt;
&lt;br /&gt;
Assuming the parameter values referred to here have &amp;#039;&amp;#039;&amp;#039;not been set&amp;#039;&amp;#039;&amp;#039; in the calling template:&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal||}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal||}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|{{{foo|}}}|}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|{{{foo|}}}|}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|{{{foo|}}}|{{{bar|}}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|{{{foo|}}}|{{{bar|}}}}}&lt;br /&gt;
Note how empty strings are not considered equal in any of these cases.&lt;br /&gt;
&lt;br /&gt;
But beware: in the following two examples, if the parameters have not been set, the &amp;#039;&amp;#039;literal strings&amp;#039;&amp;#039; &amp;quot;&amp;lt;nowiki&amp;gt;{{{foo}}}&amp;lt;/nowiki&amp;gt;&amp;quot; and &amp;quot;&amp;lt;nowiki&amp;gt;{{{bar}}}&amp;lt;/nowiki&amp;gt;&amp;quot; are used in their place.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|{{{foo}}}|}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|{{{foo}}}|}}&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifequal|{{{foo}}}|{{{bar}}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; → {{ifequal|{{{foo}}}|{{{bar}}}}}&lt;br /&gt;
The difference is the presence or absence of a vertical-bar character (&amp;lt;code&amp;gt;{{!}}&amp;lt;/code&amp;gt;) following &amp;quot;foo&amp;quot; and &amp;quot;bar&amp;quot;. See [[Help:Template#Handling parameters]] for more information about this.&lt;br /&gt;
&lt;br /&gt;
To detect whether parameter values are set or unset, use the [[mw:Help:Extension:ParserFunctions##if|{{mono|#if:}} parser function]] instead of this template.&lt;br /&gt;
&lt;br /&gt;
===See also===&lt;br /&gt;
&lt;br /&gt;
*{{tlx|ifeqall}} — Compares one &amp;#039;&amp;#039;comparison string&amp;#039;&amp;#039; against up to 10 &amp;#039;&amp;#039;case strings&amp;#039;&amp;#039; with optional &amp;#039;&amp;#039;result string&amp;#039;&amp;#039; and &amp;#039;&amp;#039;default result string&amp;#039;&amp;#039; outputs.&lt;br /&gt;
*{{tlx|ifeqany}} — Compares up to 24 &amp;#039;&amp;#039;case strings&amp;#039;&amp;#039; against each other with &amp;#039;&amp;#039;result string&amp;#039;&amp;#039; and &amp;#039;&amp;#039;default result string&amp;#039;&amp;#039; outputs.&lt;br /&gt;
*{{tlx|ifor}} — Compares up to 30 &amp;#039;&amp;#039;comparison strings&amp;#039;&amp;#039; against an equal number of &amp;#039;&amp;#039;case strings&amp;#039;&amp;#039; with optional &amp;#039;&amp;#039;result string&amp;#039;&amp;#039; and &amp;#039;&amp;#039;default result string&amp;#039;&amp;#039; outputs.&lt;br /&gt;
*{{tlx|{{=}}}} — Returns an equal sign.&lt;br /&gt;
*[[Wikipedia:Advanced template coding]]&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&amp;lt;!--&lt;br /&gt;
++++ PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANK YOU. --&amp;gt;&lt;br /&gt;
[[Category:If-then-else templates|{{PAGENAME}}]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>