34,333
edits
Changes
→Changing Variable Type
== Changing Variable Type ==
One of simplest ways to change the type of a variable is to simply assign a new value to it. Ruby is will dynamically change the type for that variable to match the type of the new value assigned. For example, we can create a variable containing an integer and verify the type:
<pre>
</pre>
As we can see, the x variable is now a string.
== Converting Variable Values ==