Artifact d688e95f1baa671719e313fad9b2a56767c4a61af75c0bc1effb2f41d834585b:
- Executable file
r37/lisp/csl/html/r37_0040.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1890) [annotate] [blame] [check-ins using] [more...]
<A NAME=BEGIN> <TITLE>BEGIN</TITLE></A> <b><a href=r37_idx.html>INDEX</a></b><p><p> <B>BEGIN</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>command</B><P> <P> <em>begin</em> is used to start a <A HREF=r37_0041.html>block</A> statement, which is closed with <em>end</em>. <P> <P> <P> <H3> syntax: </H3> <em>begin</em><statement>{<em>;</em> <statement>}* <em>end</em> <P> <P> <P> <statement> is any valid REDUCE statement. <P> <P> <P> <H3> examples: </H3> <P><PRE><TT> begin for i := 1:3 do write i end; 1 2 3 begin scalar n;n:=1;b:=for i:=1:4 product(x-i);return n end; 1 b; 4 3 2 X - 10*X + 35*X - 50*X + 24 </TT></PRE><P>A <em>begin</em>...<em>end</em> block can do actions (such as <em> write</em>), but does not return a value unless instructed to by a <A HREF=r37_0058.html>return</A> statement, which must be the last statement executed in the block. It is unnecessary to insert a semicolon before the <em>end</em>. <P> <P> Local variables, if any, are declared in the first statement immediately after <em>begin</em>, and may be defined as <em>scalar, integer,</em> or <em>real</em>. <A HREF=r37_0188.html>array</A> variables declared within a <em>begin</em>...<em>end</em> block are global in every case, and <A HREF=r37_0199.html>let</A> statements have global effects. A <A HREF=r37_0199.html>let</A> statement involving a formal parameter affects the calling parameter that corresponds to it. <A HREF=r37_0199.html>let</A> statements involving local variables make global assignments, overwriting outside variables by the same name or creating them if they do not exist. You can use this feature to affect global variables from procedures, but be careful that you do not do it inadvertently. <P> <P> <P> <P>