<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikicars.org/index.php?action=history&amp;feed=atom&amp;title=Template%3AIfexpr</id>
	<title>Template:Ifexpr - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikicars.org/index.php?action=history&amp;feed=atom&amp;title=Template%3AIfexpr"/>
	<link rel="alternate" type="text/html" href="https://wikicars.org/index.php?title=Template:Ifexpr&amp;action=history"/>
	<updated>2026-04-22T20:31:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://wikicars.org/index.php?title=Template:Ifexpr&amp;diff=176810&amp;oldid=prev</id>
		<title>Red marquis at 22:11, 22 December 2010</title>
		<link rel="alternate" type="text/html" href="https://wikicars.org/index.php?title=Template:Ifexpr&amp;diff=176810&amp;oldid=prev"/>
		<updated>2010-12-22T22:11:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;includeonly&amp;gt;{{{{{|safesubst:}}}{{{{{|safesubst:}}}#switch:{{{{{|safesubst:}}}#ifexpr:{{{1}}}|p1|p2}}|p1=p1|p2=p2|if/errmsg}}|{{{2}}}|{{{3|}}}|{{{1}}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;div class=&amp;quot;template-documentation&amp;quot; style=&amp;quot;margin-top:1em;&amp;quot;&amp;gt;{{#if:defaultnotblank|&amp;lt;div style=&amp;quot;padding-bottom:3px; border-bottom:1px solid #aaa; margin-bottom:1ex;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size:150%&amp;quot;&amp;gt;Documentation&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;}}&lt;br /&gt;
{{Documentation subpage}}&lt;br /&gt;
With this template [[mw:Help:Extension:ParserFunctions|#ifexpr]] can be used in a way such that it does not [[Help:Newlines_and_spaces#Stripping_on_expansion|strip spaces and newlines]] from the &amp;quot;then&amp;quot; and &amp;quot;else&amp;quot; part.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|2&amp;lt;3| p | q }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr|2&amp;lt;3| p | q }}&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|2&amp;gt;3| p | q }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr|2&amp;gt;3| p | q }}&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|2{{=}}3| p | q }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr|2{{=}}3| p | q }}&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr||1=2=3| p | q }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr||1=2=3| p | q }}&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr||1=7=7| ok true | no }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr||1=7=7| ok true | no }}&amp;quot;&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr||1=3*4&amp;lt;=10+1| ok| oh no}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{ifexpr||1=3*4&amp;lt;=10+1| ok| oh no}}&amp;quot;&lt;br /&gt;
Compare:&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#ifexpr:2&amp;lt;3| p | q }}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives &amp;quot;{{#ifexpr:2&amp;lt;3| p | q }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that, unlike parser functions, templates require writing equals signs in values of unnamed parameters by using double-braces, as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{=}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;. So, to allow &amp;quot;=&amp;quot; (or &amp;quot;&amp;lt;=&amp;quot; or &amp;quot;&amp;gt;=&amp;quot;) then use the named parameter 1, as in: 1={{{x}}}&amp;gt;=7.&lt;br /&gt;
&lt;br /&gt;
For full substitution, simply use {{cnw|subst:}} or {{cnw|safesubst:}}. If the condition contains a parser function, template, or variable, that should be substituted too. Optionally the &amp;quot;then&amp;quot; or &amp;quot;else&amp;quot; part can also be substituted.&lt;br /&gt;
&lt;br /&gt;
Error messages (examples):&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|1234&amp;gt;e3|1|0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives {{ifexpr|1234&amp;gt;e3|1|0}}&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#ifexpr:1234&amp;gt;e3|1|0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives {{#ifexpr:1234&amp;gt;e3|1|0}}, for e3.&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#ifexpr:1234&amp;gt;1e3|1|0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives {{#ifexpr:1234&amp;gt;1e3|1|0}}, because 1,234 &amp;gt; 1e3 (1,000).&lt;br /&gt;
&lt;br /&gt;
==Expansion depth limit==&lt;br /&gt;
13 levels allowed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|a}}}}}}}}}}}}}}}}}}}}}}}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives {{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|a}}}}}}}}}}}}}}}}}}}}}}}}}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|a}}}}}}}}}}}}}}}}}}}}}}}}}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; gives {{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|{{ifexpr|1|a}}}}}}}}}}}}}}}}}}}}}}}}}}}}&lt;br /&gt;
&lt;br /&gt;
==Internal technical details==&lt;br /&gt;
For evaluating the condition the template uses the actual parser functions; however, not directly with p and q, because this strips spaces and newlines from them, but with index values 1 and 2. The result can be 1, 2, or an error message. Using a switch these are converted to p1, p2, and if/errmsg, respectively. The template with the applicable name is called ([[Template:P1]], [[Template:P2]], or [[Template:If/errmsg]]), with as parameters p, q, and {{{1}}}. Templates p1 and p2 ignore {{{1}}}; template if/errmsg is only called in the case of a wrong expression {{{1}}}; it ignores p and q and uses {{{1}}} for display in the error message.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[m:Template:Ifexpr]]&lt;br /&gt;
{{refs}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both;&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
[[Category:Templates]]&lt;/div&gt;</summary>
		<author><name>Red marquis</name></author>
	</entry>
</feed>