Changes

Jump to: navigation, search

Understanding Ruby Variables

No change in size, 21:12, 30 November 2007
Converting Variable Values
== Converting Variable Values ==
It is important to note that the above approach is a somewhat destructive way to change a variable type. Often something a little more subtle is needed. For example, we might want to read the value form from a variable but convert the extracted value to a different type. The Ruby variable classes have methods that can be called to convert their value to a different type. For example, the ''Fixnum'' class has method named ''to_f'' that can be used to retrieve the integer stored in a variable as a floating point value:
<pre>

Navigation menu