File: ch06s07.html

package info (click to toggle)
genius 1.0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 25,308 kB
  • sloc: ansic: 75,620; xml: 71,565; sh: 4,445; makefile: 1,927; lex: 523; yacc: 298; perl: 54
file content (17 lines) | stat: -rw-r--r-- 2,339 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Rückgabewerte</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="ch06s06.html" title="Parametervariablen"><link rel="next" href="ch06s08.html" title="Referenzen"></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">Rückgabewerte</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Programmierung mit GEL</th><td width="20%" align="right"> <a accesskey="n" href="ch06s08.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-returning"></a>Rückgabewerte</h2></div></div></div><p lang="en">
	  Normally a function is one or several expressions separated by a
semicolon, and the value of the last expression is returned.  This is fine for
simple functions, but
sometimes you do not want a function to return the last thing calculated. You may, for example, want to return from a middle of a function. In this case, you can use the <code class="literal">return</code> keyword. <code class="literal">return</code> takes one argument, which is the value to be returned.
      </p><p lang="en">
Example:
</p><pre lang="en" class="programlisting">function f(x) = (
  y=1;
  while true do (
    if x&gt;50 then return y;
    y=y+1;
    x=x+1
  )
)
</pre><p lang="en">
      </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s06.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="ch06s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Parametervariablen </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Referenzen</td></tr></table></div></body></html>