Variables and identifers normally start with an alphabetic letter or a special modifier.
- Local variables (&pseudo-variables such as self and nil) begin with a lowrcase letter.
- Global variables begin with dollar sign($)
- Instance variables with an object begin with an at sign(@)
- Class variables within a class begin with two at signs @@.
- Constant begin with capital letters.
For Example
- local variables: alpha_ident,gama
- pseudo-variables:self,nil
- Constants:LENGTH,Length
- Instance variables:@sum,@not_const
- Class variable:@@my_var
- Global variable:$beta,$pi
We will see some codes in ruby in the next post