<!--
* 
*
*  ProLinga-Doc
*
*  Copyright (C) 2002-2008 Xobas Software.
*  All rights reserved.
*  
*  This file is part of ProLinga-Doc.
*
*  ProLinga-Doc is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  ProLinga-Doc is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with ProLinga-Doc.  If not, see <http://www.gnu.org/licenses/>.
*
*  More information is available at the following addresses:
*
*  Website     : http://www.prolinga.org
*
*  Email       : prolinga-list@prolinga.org
*
*
-->
<refentry id="cmd_for">
  <refmeta>
    <refentrytitle>FOR Command</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>FOR</refname>
    <refpurpose>Execute a block of logic commands a specified number of times.</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>FOR</command>
      <arg choice='plain'><replaceable>counter</replaceable></arg>
      <arg choice='plain'><option>=</option></arg>
      <arg choice='plain'><replaceable>begin_value</replaceable></arg>
      <arg choice='plain'><option>TO</option></arg>
      <arg choice='plain'><replaceable>end_value</replaceable></arg>
      <arg choice='plain'><replaceable>src_data_ref</replaceable></arg>
      <arg choice='opt'><option>STEP</option> <replaceable>increment</replaceable></arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1 id="cmd_for_introduction">
    <title>Introduction</title>
    <para>
      The <link linkend="cmd_for">FOR</link> command executes a block of logic 
      commands a specified number of times, or until a 
      <link linkend="cmd_break">BREAK</link> command is reached. The 
      <link linkend="cmd_continue">CONTINUE</link> command can also be used to 
      stop processing the current iteration and to jump to the beginning of 
      the loop.
    </para>
  </refsect1>
  <refsect1 id="cmd_for_arguments">
    <title>Arguments</title>
    <variablelist>
      <varlistentry>
	<term><replaceable>counter</replaceable></term>
	<listitem>
	  <simpara>
            Data reference of a numeric type which servers as a loop counter.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><replaceable>begin_value</replaceable></term>
	<listitem>
	  <simpara>
            Argument containing the initial start value.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><replaceable>end_value</replaceable></term>
	<listitem>
	  <simpara>
            Argument containing the end value. When this number is reached, the 
            loop structure will be terminated.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><replaceable>increment</replaceable></term>
	<listitem>
	  <simpara>
            The value of this argument will be added to the counter after every 
            loop iteration. When STEP is not defined, the default of 1 will 
            be used.
	  </simpara>
	</listitem>
      </varlistentry>
    </variablelist>

  </refsect1>

  <refsect1 id="cmd_for_example">
    <title>Example</title>
<programlisting>
. . .
. . .
FOR L-Counter = 1 TO 4 STEP 1
    LET V-status = CALL ProcessOrder L-Counter
ENDFOR
. . .
. . .
</programlisting>
  </refsect1>

  <refsect1 id="cmd_for_related">
    <title>Related Commands</title>
    <para>
      <link linkend="cmd_break">BREAK</link>
      <link linkend="cmd_continue">CONTINUE</link>
      <link linkend="cmd_endfor">ENDFOR</link>
    </para>
  </refsect1>

</refentry>

