Debian Codegraph @

help/de/html/ch06s04.html

raw symbols SCIP
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Vergleichsoperatoren</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius-Handbuch"><link rel="up" href="ch06.html" title="Chapter 6. Programmierung mit GEL"><link rel="prev" href="ch06s03.html" title="Summen und Produkte"><link rel="next" href="ch06s05.html" title="Globale Variablen und Variablenbereiche"></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">Vergleichsoperatoren</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s03.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Programmierung mit GEL</th><td width="20%" align="right"> <a accesskey="n" href="ch06s05.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-comparison-operators"></a>Vergleichsoperatoren</h2></div></div></div><p lang="en">
2 The following standard comparison operators are supported in GEL and have the obvious meaning:
3 <code class="literal">==</code>, <code class="literal">&gt;=</code>,
4 <code class="literal">&lt;=</code>, <code class="literal">!=</code>,
5 <code class="literal">&lt;&gt;</code>, <code class="literal">&lt;</code>,
6 <code class="literal">&gt;</code>. They return <code class="constant">true</code> or
7 <code class="constant">false</code>.
8 The operators
9 <code class="literal">!=</code> and <code class="literal">&lt;&gt;</code> are the same
10 thing and mean "is not equal to".
11 GEL also supports the operator
12 <code class="literal">&lt;=&gt;</code>, which returns -1 if left side is
13 smaller, 0 if both sides are equal, 1 if left side is larger.
14 </p><p lang="en">
15 Normally <code class="literal">=</code> is translated to <code class="literal">==</code> if
16 it happens to be somewhere where GEL is expecting a condition such as
17 in the if condition. For example
18 </p><pre lang="en" class="programlisting">if a=b then c
19 if a==b then c
20 </pre><p lang="en">
21 are the same thing in GEL. However you should really use
22 <code class="literal">==</code> or <code class="literal">:=</code> when you want to compare
23 or assign respectively if you want your code to be easy to read and
24 to avoid mistakes.
25 </p><p lang="en">
26 All the comparison operators (except for the
27 <code class="literal">&lt;=&gt;</code> operator, which
28 behaves normally), are not strictly binary operators, they can in fact
29 be grouped in the normal mathematical way, e.g.:
30 (<code class="literal">1&lt;x&lt;=y&lt;5</code>) is
31 a legal boolean expression and means just what it should, that is
32 (1&lt;x and x≤y and y&lt;5)
33 </p><p lang="en">
34 To build up logical expressions use the words <code class="literal">not</code>,
35 <code class="literal">and</code>, <code class="literal">or</code>, <code class="literal">xor</code>.
36 The operators <code class="literal">or</code> and <code class="literal">and</code> are
37 special beasts as they evaluate their arguments one by one, so the usual trick
38 for conditional evaluation works here as well. For example, <code class="literal">1 or a=1</code> will not set
39 <code class="literal">a=1</code> since the first argument was true.
40 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Summen und Produkte </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Globale Variablen und Variablenbereiche</td></tr></table></div></body></html>