title: Convert decimal into binary, octal, and hexadecimal?
body: <p>I am trying to convert a variable, which will always be a number, into binary, octal, and hex with Ruby.</p>
  
  <p>The code I have at this point is:</p>
  
  <pre><code>def convert(number)
    puts "#{number} in decimal is"
    puts "#{number.to_s(2)} in binary"
    puts "#{number.to_s(8)} in octal"
    puts "#{number.to_s(16)} in hexadecimal"
  end
  </code></pre>
  
  <p>and so far the output is:</p>
  
  <pre><code>2 in decimal is
  10 in binary
  2 in octal
  2 in hexadecimal
  </code></pre>
  
  <p>The first two lines run fine, but after that it is ignoring the conversion command and just putting the variable in. Does anyone have any idea what it is I am missing?</p>