1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 6. Programování s jazykem GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Příručka k aplikaci Genius"><link rel="up" href="index.html" title="Příručka k aplikaci Genius"><link rel="prev" href="ch05s07.html" title="Seznam operátorů GEL"><link rel="next" href="ch06s02.html" title="Smyčky"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. Programování s jazykem GEL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s07.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel-programming"></a>Chapter 6. Programování s jazykem GEL</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch06.html#genius-gel-conditionals">Podmínky</a></span></dt><dt><span class="sect1"><a href="ch06s02.html">Smyčky</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch06s02.html#genius-gel-loops-while">Smyčky while</a></span></dt><dt><span class="sect2"><a href="ch06s02.html#genius-gel-loops-for">Smyčky for</a></span></dt><dt><span class="sect2"><a href="ch06s02.html#genius-gel-loops-foreach">Smyčky foreach</a></span></dt><dt><span class="sect2"><a href="ch06s02.html#genius-gel-loops-break-continue">Break a continue</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch06s03.html">Součty a součiny</a></span></dt><dt><span class="sect1"><a href="ch06s04.html">Porovnávací operátory</a></span></dt><dt><span class="sect1"><a href="ch06s05.html">Globální proměnné a působnost proměnných</a></span></dt><dt><span class="sect1"><a href="ch06s06.html">Proměnné parametrů</a></span></dt><dt><span class="sect1"><a href="ch06s07.html">Návrat hodnot</a></span></dt><dt><span class="sect1"><a href="ch06s08.html">Reference</a></span></dt><dt><span class="sect1"><a href="ch06s09.html">L-hodnoty</a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-conditionals"></a>Podmínky</h2></div></div></div><p lang="en">
Syntax:
</p><pre lang="en" class="programlisting">if <expression1> then <expression2> [else <expression3>]
</pre><p lang="en">
If <code class="literal">else</code> is omitted, then if the <code class="literal">expression1</code> yields <code class="constant">false</code> or 0, <code class="literal">NULL</code> is returned.
</p><p lang="en">
Examples:
</p><pre lang="en" class="programlisting">if(a==5)then(a=a-1)
if b<a then b=a
if c>0 then c=c-1 else c=0
a = ( if b>0 then b else 1 )
</pre><p lang="en">
Note that <code class="literal">=</code> will be translated to <code class="literal">==</code> if used inside the expression for <code class="literal">if</code>, so
</p><pre lang="en" class="programlisting">if a=5 then a=a-1
</pre><p lang="en">
will be interpreted as:
</p><pre lang="en" class="programlisting">if a==5 then a:=a-1
</pre><p lang="en">
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05s07.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Seznam operátorů GEL </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Smyčky</td></tr></table></div></body></html>
|