Files
Ekaterina Tuzova 057c23e3f4 fixed PY-14822 Show external documentation about Python keywords
added builtin documentation for python keywords
2015-09-06 21:08:45 +03:00

15 lines
2.0 KiB
Plaintext

<div class="section" id="the-if-statement">
<span id="else"></span><span id="elif"></span><span id="if"></span><h2>The <a class="reference internal" href="#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a> statement</h2>
<p id="index-3">The <a class="reference internal" href="#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a> statement is used for conditional execution:</p>
<pre>
<strong id="grammar-token-if_stmt">if_stmt</strong> ::= &quot;if&quot; <a class="reference internal" href="expressions.html#grammar-token-expression"><tt class="xref docutils literal"><span class="pre">expression</span></tt></a> &quot;:&quot; <a class="reference internal" href="#grammar-token-suite"><tt class="xref docutils literal"><span class="pre">suite</span></tt></a>
( &quot;elif&quot; <a class="reference internal" href="expressions.html#grammar-token-expression"><tt class="xref docutils literal"><span class="pre">expression</span></tt></a> &quot;:&quot; <a class="reference internal" href="#grammar-token-suite"><tt class="xref docutils literal"><span class="pre">suite</span></tt></a> )*
[&quot;else&quot; &quot;:&quot; <a class="reference internal" href="#grammar-token-suite"><tt class="xref docutils literal"><span class="pre">suite</span></tt></a>]
</pre>
<p>It selects exactly one of the suites by evaluating the expressions one by one
until one is found to be true (see section <a class="reference internal" href="expressions.html#booleans"><em>Boolean operations</em></a> for the definition of
true and false); then that suite is executed (and no other part of the
<a class="reference internal" href="#if"><tt class="xref std std-keyword docutils literal"><span class="pre">if</span></tt></a> statement is executed or evaluated). If all expressions are
false, the suite of the <a class="reference internal" href="#else"><tt class="xref std std-keyword docutils literal"><span class="pre">else</span></tt></a> clause, if present, is executed.</p>
</div>