Changes

Jump to: navigation, search

Ruby Variable Scope

No change in size, 18:44, 15 November 2007
What is Variable Scope?
<tr style="background:#efefef;">
<th>Name Begins With<th>Variable Scope</th>
<tr><td><code>$</code> </td><td> a A global variable </td></tr>
<tr><td>
<code>@</code> </td><td> An instance variable </td></tr>
<code>[A-Z]</code> </td><td>A constant</td></tr>
<tr><td>
<code>@@</code></td><td>A class variable</td></tr></table>
In addition, Ruby has two ''pseudo-variables'' which cannot be assigned values. These are ''nil'' which is assigned to uninitialized variables and ''self'' which refers to the currently executing object.

Navigation menu