1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Oddělovač</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="ch05.html" title="Chapter 5. Základy jazyka GEL"><link rel="prev" href="ch05s03.html" title="Používání funkcí"><link rel="next" href="ch05s05.html" title="Komentáře"></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">Oddělovač</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a> </td><th width="60%" align="center">Chapter 5. Základy jazyka GEL</th><td width="20%" align="right"> <a accesskey="n" href="ch05s05.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-separator"></a>Oddělovač</h2></div></div></div><p lang="en">
GEL is somewhat different from other languages in how it deals with multiple commands and functions.
In GEL you must chain commands together with a separator operator.
That is, if you want to type more than one expression you have to use
the <code class="literal">;</code> operator in between the expressions. This is
a way in which both expressions are evaluated and the result of the second one (or the last one
if there is more than two expressions) is returned.
Suppose you type the following:
</p><pre lang="en" class="programlisting">3 ; 5
</pre><p lang="en">
This expression will yield 5.
</p><p lang="en">
This will require some parenthesizing to make it unambiguous sometimes,
especially if the <code class="literal">;</code> is not the top most primitive. This slightly differs from
other programming languages where the <code class="literal">;</code> is a terminator of statements, whereas
in GEL it’s actually a binary operator. If you are familiar with pascal
this should be second nature. However genius can let you pretend it is a
terminator to some degree. If a <code class="literal">;</code> is found at the end of a parenthesis or a block,
genius will append a null to it as if you would have written
<strong class="userinput"><code>;null</code></strong>.
This is useful in case you do not want to return a value from a loop,
or if you handle the return differently.
</p><p lang="en">
If you are typing expressions in a program file you do not have to add a semicolon. In this case
genius will simply print the return value whenever it executes the expression. This is the same
as when typing on the command line. However, do note that if you are defining a
function, the body of the function is a single expression. Usually, therefore, if a function body is
long, you will need to enclose it in parentheses.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch05.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch05s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Používání funkcí </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Komentáře</td></tr></table></div></body></html>
|