<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="r">
  <refmeta>
    <refentrytitle>r Statement (Repeat Statement)</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>r</refname>
    <refpurpose>
      Starts a repeated section.
      <indexterm id="IndexRStatement"><primary>r statement</primary></indexterm>
      <indexterm id="IndexRepeatStatement"><primary>repeat statement</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Starts a repeated section, which lasts until the next <emphasis>s</emphasis>, <emphasis>r</emphasis> or <emphasis>e statement</emphasis>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>r</command> p1 p2</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>p1</emphasis> -- Number of times to repeat the section.
    </para>

    <para>
      <emphasis>p2</emphasis> -- Macro(name) to advance with each repetition (optional).
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      In order that the sections may be more flexible than simple editing, the macro named p2 is given the value of 1 for the first time through the section, 2 for the second, and 3 for the third.  This can be used to change p-field parameters, or ignored.
    </para>

    <warning>
      <title>Warning</title>
      <para>
        Because of serious problems of interaction with macro expansion, sections must start and end in the same file, and not in a macro.
      </para>
    </warning>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the r statement. It uses the files <ulink url="examples/r.orc"><citetitle>r.orc</citetitle></ulink> and <ulink url="examples/r.sco"><citetitle>r.sco</citetitle></ulink>.

      <example>
        <title>Example of the r statement.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/r.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/r.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namejohn;</member>
        <member>University of Bath/Codemist Ltd.</member>
        <member>Bath, UK</member>
        <member>April, 1998</member>
      </simplelist>
    </para>

    <para>New in Csound version 3.48</para>
    <para>Example written by &namekevin;</para>
  </refsect1>
</refentry>
