<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fa" lang="fa" dir="rtl">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    		<meta name="keywords" content="بحث الگو:Ifdef,Ifdef,Tlx,!,Qif,Ifndef,Tlx,!,Qif,Ifdef/,Ifndef" />
		<link rel="shortcut icon" href="/favicon.ico" />
		<link rel="search" type="application/opensearchdescription+xml" href="/w/opensearch_desc.php" title="ویکی‌پدیا (فارسی)" />
		<link rel="copyright" href="../../../COPYING.html" />
    <title>بحث الگو:Ifdef - ویکی‌پدیا</title>
    <style type="text/css">/*<![CDATA[*/ @import "../../../skins/htmldump/main.css"; /*]]>*/</style>
    <link rel="stylesheet" type="text/css" media="print" href="../../../skins/common/commonPrint.css" />
    <!--[if lt IE 5.5000]><style type="text/css">@import "../../../skins/monobook/IE50Fixes.css";</style><![endif]-->
    <!--[if IE 5.5000]><style type="text/css">@import "../../../skins/monobook/IE55Fixes.css";</style><![endif]-->
    <!--[if IE 6]><style type="text/css">@import "../../../skins/monobook/IE60Fixes.css";</style><![endif]-->
    <!--[if IE]><script type="text/javascript" src="../../../skins/common/IEFixes.js"></script>
    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
    <script type="text/javascript" src="../../../skins/common/wikibits.js"></script>
    <script type="text/javascript" src="../../../skins/htmldump/md5.js"></script>
    <script type="text/javascript" src="../../../skins/htmldump/utf8.js"></script>
    <script type="text/javascript" src="../../../skins/htmldump/lookup.js"></script>
    <script type="text/javascript" src="../../../raw/gen.js"></script>        <style type="text/css">/*<![CDATA[*/
@import "../../../skins/monobook/rtl.css?99";
@import "../../../raw/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C%7ECommon.css";
@import "../../../raw/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C%7EMonobook.css";
@import "../../../raw/gen.css";
/*]]>*/</style>          </head>
  <body
    class="ns-11">
    <div id="globalWrapper">
      <div id="column-content">
	<div id="content">
	  <a name="top" id="contentTop"></a>
	        <h1 class="firstHeading">بحث الگو:Ifdef</h1>
	  <div id="bodyContent">
	    <h3 id="siteSub">از ویکی‌پدیا، دانشنامهٔ آزاد.</h3>
	    <div id="contentSub"></div>
	    	    	    <!-- start content -->
	    <div dir="ltr">
<table id="toc" class="toc" summary="فهرست مندرجات">
<tr>
<td>
<div id="toctitle">
<h2>فهرست مندرجات</h2>
</div>
<ul>
<li class="toclevel-1"><a href="#Documentation"><span class="tocnumber">۱</span> <span class="toctext">Documentation</span></a>
<ul>
<li class="toclevel-2"><a href="#Usage"><span class="tocnumber">۱.۱</span> <span class="toctext">Usage</span></a></li>
<li class="toclevel-2"><a href="#Example"><span class="tocnumber">۱.۲</span> <span class="toctext">Example</span></a></li>
<li class="toclevel-2"><a href="#Caveats"><span class="tocnumber">۱.۳</span> <span class="toctext">Caveats</span></a></li>
<li class="toclevel-2"><a href="#See_also"><span class="tocnumber">۱.۴</span> <span class="toctext">See also</span></a></li>
</ul>
</li>
</ul>
</td>
</tr>
</table>
<script type="text/javascript">
//<![CDATA[
 if (window.showTocToggle) { var tocShowText = "نمایش داده شود"; var tocHideText = "مخفی شود"; showTocToggle(); } 
//]]>
</script> <a name="Documentation" id="Documentation"></a>
<h2><span class="editsection">[<a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html" title="ویرایش بخش: Documentation">ویرایش</a>]</span> <span class="mw-headline">Documentation</span></h2>
<p><code>{{<a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" title="الگو:Ifdef">ifdef</a>}}</code> is a compact variant of {{<a href="../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" title="الگو:Qif">Qif</a>}} for simple "<b>if</b> <i>defined</i> <b>then</b> <i>do</i>" statements without <b>else</b> part. It's the opposite of {{ifndef}}.</p>
<a name="Usage" id="Usage"></a>
<h3><span class="editsection">[<a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html" title="ویرایش بخش: Usage">ویرایش</a>]</span> <span class="mw-headline">Usage</span></h3>
<p><code>{{Ifdef|value|result}}</code> yields <i>result</i>&#160; if <i>value</i>&#160; isn't blank.</p>
<p>This template is used to simplify the following equivalent but somewhat cryptic code variants:</p>
<dl>
<dd><code>{{{1{{{1<b>|</b>}}}<b>|</b>{{{2}}}}}}</code></dd>
<dd><code>{{{value{{{value<b>|</b>}}}<b>|</b>{{{result}}}}}}</code></dd>
<dd><code>{{{test{{{test<b>|</b>}}}<b>|</b>{{{then}}}}}}</code></dd>
</dl>
<p><br /></p>
<a name="Example" id="Example"></a>
<h3><span class="editsection">[<a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html" title="ویرایش بخش: Example">ویرایش</a>]</span> <span class="mw-headline">Example</span></h3>
<table border="1">
<tr>
<td><b>Code</b></td>
<td><b>Result</b></td>
</tr>
<tr>
<td valign="top"><code>1 {{Ifdef| |empty}}</code></td>
<td>1</td>
</tr>
<tr>
<td valign="top"><code>2 {{Ifdef|x|gotcha}}</code></td>
<td>2 gotcha</td>
</tr>
<tr>
<td valign="top"><code>3 {{Ifdef| {{{1| }}} | {{{1| }}} undefined}}</code></td>
<td>3</td>
</tr>
<tr>
<td valign="top"><code>4 {{Ifdef| {{{1|x}}} | {{{1|x}}} for an u}}</code></td>
<td>4 x for an u</td>
</tr>
<tr>
<td valign="top"><code>5 {{Ifdef| {{{ 1 }}} | {{{1}}} bad idea}}</code></td>
<td>5 {{{1}}} bad idea</td>
</tr>
<tr>
<td valign="top"><code>6 {{Ifdef| {{!}} |see also {{Tlx|Qif}} }}</code></td>
<td>6 see also {{<a href="../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" title="الگو:Qif">Qif</a>}}</td>
</tr>
<tr>
<td valign="top"><code>7 {{Ifdef| okay | 2=see=[[#Caveats]] }}</code></td>
<td>7 see=<a href="#Caveats" title="">#Caveats</a></td>
</tr>
<tr>
<td valign="top"><code>8 {{Ifdef| oops | see=[[#Caveats]] }}</code></td>
<td>8 {{{2}}}</td>
</tr>
</table>
<p><i>See also a simpler example using <b>ifdef</b>. There's no default in <b>ifdef</b> for the second parameter, because this could hide problematic code.</i></p>
<a name="Caveats" id="Caveats"></a>
<h3><span class="editsection">[<a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html" title="ویرایش بخش: Caveats">ویرایش</a>]</span> <span class="mw-headline">Caveats</span></h3>
<p>In templates the characters "<tt><b>=</b></tt>" (&amp;#61;) and "<tt><b>|</b></tt>" (&amp;#124;) cannot be used as is in parameters. The <i>numeric character references</i> &amp;#61; and &amp;#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:</p>
<ol>
<li>For <tt><b>|</b></tt> <span class="plainlinksneverexpand"><a href="../../../%21/_/_/%D8%A7%D9%84%DA%AF%D9%88%7E%21.html" title="الگو:!">Template:!</a>&#160;<tt>(</tt><small><a href="http://fa.wikipedia.org../../../%21/_/_/%D8%A7%D9%84%DA%AF%D9%88%7E%21.html" class="external text" title="http://fa.wikipedia.org../../../%21/_/_/%D8%A7%D9%84%DA%AF%D9%88%7E%21.html" rel="nofollow">edit</a>&#160;talk&#160;<a href="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7E%21_6c64.html" class="external text" title="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7E%21_6c64.html" rel="nofollow">links</a>&#160;<a href="http://fa.wikipedia.org../../../%21/_/_/%D8%A7%D9%84%DA%AF%D9%88%7E%21.html" class="external text" title="http://fa.wikipedia.org../../../%21/_/_/%D8%A7%D9%84%DA%AF%D9%88%7E%21.html" rel="nofollow">history</a></small><tt>)</tt></span> offers a workaround.</li>
<li>For <tt><b>=</b></tt> the template parameter mechanism allows {{<a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" title="الگو:Ifdef">ifdef</a><tt>|</tt>1<tt>|</tt>2=ok=yes}} resulting in "ok=yes" instead of {{<a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" title="الگو:Ifdef">ifdef</a><tt>|</tt>1<tt>|</tt>bad=idea}} resulting in "{{{2}}}".</li>
</ol>
<p>Substitution works only for {{<a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" title="الگو:Ifdef">ifdef</a>}}, but <b>not</b> for {{ifndef}} or {{<a href="../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" title="الگو:Qif">qif</a>}}.</p>
<a name="See_also" id="See_also"></a>
<h3><span class="editsection">[<a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html" title="ویرایش بخش: See also">ویرایش</a>]</span> <span class="mw-headline">See also</span></h3>
<ul>
<li><span class="plainlinksneverexpand"><a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" title="الگو:Ifdef">Template:Ifdef</a>&#160;<tt>(</tt><small><a href="http://fa.wikipedia.org../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" class="external text" title="http://fa.wikipedia.org../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" rel="nofollow">edit</a>&#160;<strong class="selflink">talk</strong>&#160;<a href="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7EIfdef_46b0.html" class="external text" title="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7EIfdef_46b0.html" rel="nofollow">links</a>&#160;<a href="http://fa.wikipedia.org../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" class="external text" title="http://fa.wikipedia.org../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html" rel="nofollow">history</a></small><tt>)</tt></span></li>
<li><span class="plainlinksneverexpand">Template:Ifndef&#160;<tt>(</tt><small><a href="http://fa.wikipedia.org../../../i/f/n/%D8%A7%D9%84%DA%AF%D9%88%7EIfndef_08ec.html" class="external text" title="http://fa.wikipedia.org../../../i/f/n/%D8%A7%D9%84%DA%AF%D9%88%7EIfndef_08ec.html" rel="nofollow">edit</a>&#160;talk&#160;<a href="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7Eifndef_76e6.html" class="external text" title="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7Eifndef_76e6.html" rel="nofollow">links</a>&#160;<a href="http://fa.wikipedia.org../../../i/f/n/%D8%A7%D9%84%DA%AF%D9%88%7EIfndef_08ec.html" class="external text" title="http://fa.wikipedia.org../../../i/f/n/%D8%A7%D9%84%DA%AF%D9%88%7EIfndef_08ec.html" rel="nofollow">history</a></small><tt>)</tt></span></li>
<li><span class="plainlinksneverexpand"><a href="../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" title="الگو:Qif">Template:Qif</a>&#160;<tt>(</tt><small><a href="http://fa.wikipedia.org../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" class="external text" title="http://fa.wikipedia.org../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" rel="nofollow">edit</a>&#160;talk&#160;<a href="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7EQif_5ad5.html" class="external text" title="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7EQif_5ad5.html" rel="nofollow">links</a>&#160;<a href="http://fa.wikipedia.org../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" class="external text" title="http://fa.wikipedia.org../../../q/i/f/%D8%A7%D9%84%DA%AF%D9%88%7EQif_b3f9.html" rel="nofollow">history</a></small><tt>)</tt></span></li>
<li><span class="plainlinksneverexpand"><a href="../../../t/l/x/%D8%A7%D9%84%DA%AF%D9%88%7ETlx_680b.html" title="الگو:Tlx">Template:Tlx</a>&#160;<tt>(</tt><small><a href="http://fa.wikipedia.org../../../t/l/x/%D8%A7%D9%84%DA%AF%D9%88%7ETlx_680b.html" class="external text" title="http://fa.wikipedia.org../../../t/l/x/%D8%A7%D9%84%DA%AF%D9%88%7ETlx_680b.html" rel="nofollow">edit</a>&#160;talk&#160;<a href="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7ETlx_7328.html" class="external text" title="http://fa.wikipedia.org../../../w/h/a/%D9%88%DB%8C%DA%98%D9%87%7EWhatlinkshere_Template%7ETlx_7328.html" rel="nofollow">links</a>&#160;<a href="http://fa.wikipedia.org../../../t/l/x/%D8%A7%D9%84%DA%AF%D9%88%7ETlx_680b.html" class="external text" title="http://fa.wikipedia.org../../../t/l/x/%D8%A7%D9%84%DA%AF%D9%88%7ETlx_680b.html" rel="nofollow">history</a></small><tt>)</tt></span> <i>example uses of</i> <b>Ifdef</b></li>
<li><a href="http://meta.wikimedia.org/wiki/ParserFunctions" class="extiw" title="m:ParserFunctions">Parser functions</a> <b>#expr:</b>, <b>#if:</b>, <b>#ifeq:</b>, etc.</li>
</ul>
</div>

<!-- 
Pre-expand include size: 14295 bytes
Post-expand include size: 4406 bytes
Template argument size: 665 bytes
Maximum: 2048000 bytes
-->
<div class="printfooter">
برگرفته از «<a href="http://fa.wikipedia.org../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html">http://fa.wikipedia.org../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html</a>»</div>
	    	    <!-- end content -->
	    <div class="visualClear"></div>
	  </div>
	</div>
      </div>
      <div id="column-one">
	<div id="p-cactions" class="portlet">
	  <h5>Views</h5>
	  <ul>
	    <li id="ca-nstab-template"
	       	       ><a href="../../../i/f/d/%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_e133.html">الگو</a></li><li id="ca-talk"
	       class="selected"	       ><a href="../../../i/f/d/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88%7EIfdef_df40.html">بحث</a></li><li id="ca-current"
	       	       ><a href="http://fa.wikipedia.org/wiki/%D8%A8%D8%AD%D8%AB_%D8%A7%D9%84%DA%AF%D9%88:Ifdef">نسخهٔ فعلی</a></li>	  </ul>
	</div>
	<div class="portlet" id="p-logo">
	  <a style="background-image: url(../../../upload/b/bc/Wiki.png);"
	    href="../../../index.html"
	    title="صفحهٔ اصلی"></a>
	</div>
	<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
		<div class='portlet' id='p-navigation'>
	  <h5>گشتن</h5>
	  <div class='pBody'>
	    <ul>
	    	      <li id="n-mainpage"><a href="../../../index.html">صفحهٔ اصلی</a></li>
	     	      <li id="n-portal"><a href="../../../%D8%AF/%D8%B1/%DA%AF/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7%7E%D8%AF%D8%B1%DA%AF%D8%A7%D9%87_%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1%D8%A7%D9%86.html">درگاه کاربران</a></li>
	     	      <li id="n-currentevents"><a href="../../../%D9%88/%D9%82/%D8%A7/%D8%AF%D8%B1%DA%AF%D8%A7%D9%87%7E%D9%88%D9%82%D8%A7%DB%8C%D8%B9_%DA%A9%D9%86%D9%88%D9%86%DB%8C.html">وقایع کنونی</a></li>
	     	      <li id="n-help"><a href="../../../%D8%B1/%D8%A7/%D9%87/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7%7E%D8%B1%D8%A7%D9%87%D9%86%D9%85%D8%A7.html">راهنما</a></li>
	     	      <li id="n-sitesupport"><a href="http://wikimediafoundation.org/wiki/Fundraising">کمک مالی</a></li>
	     	    </ul>
	  </div>
	</div>
		<div id="p-search" class="portlet">
	  <h5><label for="searchInput">جستجو</label></h5>
	  <div id="searchBody" class="pBody">
	    <form action="javascript:goToStatic(3)" id="searchform"><div>
	      <input id="searchInput" name="search" type="text"
	        accesskey="f" value="" />
	      <input type='submit' name="go" class="searchButton" id="searchGoButton"
	        value="برود" />
	    </div></form>
	  </div>
	</div>
	      </div><!-- end of the left (by default at least) column -->
      <div class="visualClear"></div>
      <div id="footer">
    <div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="../../../skins/common/images/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" /></a></div>	<div id="f-copyrightico"><a href="http://wikimediafoundation.org/"><img src="../../../images/wikimedia-button.png" border="0" alt="Wikimedia Foundation"/></a></div>	<ul id="f-list">
	  	  	  <li id="f-credits">این صفحه آخرین بار در ۰۰:۳۸، ۵ مه ۲۰۰۷ به دست <a href="../../../m/m/e/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1%7EMmehdi.g_8b2d.html" title="کاربر:Mmehdi.g">Mmehdi.g</a>، کاربر ویکی‌پدیا تغییر یافته‌است. </li>	  <li id="f-copyright">محتویات تحت اجازه‌نامهٔ <a href="../../../COPYING.html" class="external " title="../../../COPYING.html" rel="nofollow">GNU Free Documentation License</a> در دسترس است.</li>	  <li id="f-about"><a href="../../../%D8%AF/%D8%B1/%D8%A8/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7%7E%D8%AF%D8%B1%D8%A8%D8%A7%D8%B1%D9%87.html" title="ویکی‌پدیا:درباره">دربارهٔ ویکی‌پدیا</a></li>	  <li id="f-disclaimer"><a href="../../../%D8%AA/%DA%A9/%D8%B0/%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7%7E%D8%AA%DA%A9%D8%B0%DB%8C%D8%A8%E2%80%8C%D9%86%D8%A7%D9%85%D9%87%D9%94_%D8%B9%D9%85%D9%88%D9%85%DB%8C.html" title="ویکی‌پدیا:تکذیب‌نامهٔ عمومی">تکذیب‌نامه‌ها</a></li>	  	</ul>
      </div>
    </div>
  </body>
</html>
