On 03.01.2010 17:53, Panagiotis Atmatzidis wrote:
> Okay returns the last statement, but is it a number or a string?
Depends on what was thrown into it, and what was done to it in the
process. ;)
In your case, it's a number.
A neat way to test this is capturing the output of a function in a
variable, and do a
puts variable.class
which prints the Class of the variable (everything's an Object in Ruby,
and thus has a class, more or less).
For example:
puts Array.new.class
puts [].class
puts "string".class
puts 1.class
puts 1.0.class # Ruby knows you are using a Float here
puts Class.class
etc. pp.