<ppdoc>
<copyright>
Copyright (c) 2001 by Addison Wesley Longman, Inc. This material may
be distributed only subject to the terms and conditions set forth in
the Open Publication License, v1.0 or later (the latest version is
presently available at http://www.opencontent.org/openpub/).
<p/>
Distribution of substantively modified versions of this document is
prohibited without the explicit permission of the copyright holder.
<p/>
Distribution of the work or derivative of the work in any standard
(paper) book form is prohibited unless prior permission is obtained
from the copyright holder.
</copyright>
<class name="Integer" super="Numeric" type="class" ref="xref-000001">    <subclasses>Bignum, Fixnum</subclasses>
<p/>
  <classname>Integer</classname> is the basis for the two concrete classes that hold
  whole numbers, <classname>Bignum</classname> and <classname>Fixnum</classname>.
<p/>
  <methods type="instance">
        <method name="chr" ref="chr">
      <callseq>
        <obj>int</obj>.chr <returns><obj>aString</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a string containing the ASCII character represented by 
      the receiver's value.            
<p/>
<codefragment>
<fullcode><![CDATA[        65.chr
        ?a.chr
        230.chr
]]></fullcode><rubycode>
<tr>
  <td><tt>65.chr</tt></td>
  <td>&#187;</td>
  <td><tt>"A"</tt></td>
</tr>
<tr>
  <td><tt>?a.chr</tt></td>
  <td>&#187;</td>
  <td><tt>"a"</tt></td>
</tr>
<tr>
  <td><tt>230.chr</tt></td>
  <td>&#187;</td>
  <td><tt>"\346"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="downto" ref="downto">
      <callseq>
        <obj>int</obj>.downto( <obj>anInteger</obj> ) <block>{| i | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>int</obj></returns>
      </callseq>
      <desc>
<p/>
      Iterates <em>block</em>, passing decreasing values
      from <obj>int</obj> down to and including <obj>anInteger</obj>.      
<p/>
<codefragment>
<alltt><fullcode><![CDATA[         5.downto(1) { |n| print n, ".. " }
         print "  Liftoff!\n"
]]></fullcode>
5.downto(1)<nbsp/>{<nbsp/>|n|<nbsp/>print<nbsp/>n,<nbsp/>"..<nbsp/>"<nbsp/>}
print<nbsp/>"<nbsp/><nbsp/>Liftoff!\n"
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
5..<nbsp/>4..<nbsp/>3..<nbsp/>2..<nbsp/>1..<nbsp/><nbsp/><nbsp/>Liftoff!
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="integer?" ref="integer_qm">
      <callseq>
        <obj>int</obj>.integer? <returns><const>true</const></returns>
      </callseq>
      <desc>
<p/>
      Always returns <const>true</const>.
<p/>
      </desc>
    </method>
<p/>
        <method name="next" ref="next">
      <callseq>
        <obj>int</obj>.next <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns the <classname>Integer</classname> equal to <obj>int</obj><nbsp/>+<nbsp/>1.
<p/>
<codefragment>
<fullcode><![CDATA[        1.next
        (-1).next
]]></fullcode><rubycode>
<tr>
  <td><tt>1.next</tt></td>
  <td>&#187;</td>
  <td><tt>2</tt></td>
</tr>
<tr>
  <td><tt>(-1).next</tt></td>
  <td>&#187;</td>
  <td><tt>0</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="step" ref="step">
      <callseq>
        <obj>int</obj>.step( <obj>endNum</obj>, <obj>step</obj> ) <block>{| i | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>int</obj></returns>
      </callseq>
      <desc>
<p/>
      Invokes <em>block</em> with the sequence of numbers starting at
      <obj>int</obj>,      
      incremented by <obj>step</obj> on each call. The loop
      finishes when the value to be passed to the block is greater
      than <obj>endNum</obj> (if <obj>step</obj> is positive) or less than
      <obj>endNum</obj> (if <obj>step</obj> is negative).
<p/>
<codefragment>
<alltt><fullcode><![CDATA[        1.step(10, 2) { |i| print i, " " }
!-      print "\n"
]]></fullcode>
1.step(10,<nbsp/>2)<nbsp/>{<nbsp/>|i|<nbsp/>print<nbsp/>i,<nbsp/>"<nbsp/>"<nbsp/>}
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
1<nbsp/>3<nbsp/>5<nbsp/>7<nbsp/>9
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="succ" ref="succ">
      <callseq>
        <obj>int</obj>.succ <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <cim><file>integer</file><front>Integer</front><back>next</back><mref>next</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
        <method name="times" ref="times">
      <callseq>
        <obj>int</obj>.times <block>{| i | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>int</obj></returns>
      </callseq>
      <desc>
<p/>
      Iterates block <obj>int</obj> times, passing in values from zero to
      <obj>int</obj> - 1.      
<p/>
<codefragment>
<alltt><fullcode><![CDATA[         5.times do |i|
           print i, " "
         end
         print "\n"
]]></fullcode>
5.times<nbsp/>do<nbsp/>|i|
<nbsp/><nbsp/>print<nbsp/>i,<nbsp/>"<nbsp/>"
end
print<nbsp/>"\n"
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
0<nbsp/>1<nbsp/>2<nbsp/>3<nbsp/>4
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="upto" ref="upto">
      <callseq>
        <obj>int</obj>.upto( <obj>anInteger</obj> ) <block>{| i | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>int</obj></returns>
      </callseq>
      <desc>
<p/>
      Iterates <em>block</em>, passing in integer values from
      <obj>int</obj> up to and including <obj>anInteger</obj>.      
<p/>
<codefragment>
<alltt><fullcode><![CDATA[         5.upto(10) { |i| print i, " " }
!-         print "\n"
]]></fullcode>
5.upto(10)<nbsp/>{<nbsp/>|i|<nbsp/>print<nbsp/>i,<nbsp/>"<nbsp/>"<nbsp/>}
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
5<nbsp/>6<nbsp/>7<nbsp/>8<nbsp/>9<nbsp/>10
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
  </methods>
<p/>
</class>
</ppdoc>
