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