HEMANT SONKER’S BLOG

September 21, 2007

More stuffs on Ruby

Filed under: ruby — Hemant Sonker @ 4:16 pm

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

  1. local variables: alpha_ident,gama
  2. pseudo-variables:self,nil
  3. Constants:LENGTH,Length
  4. Instance variables:@sum,@not_const
  5. Class variable:@@my_var
  6. Global variable:$beta,$pi

We will see some codes in ruby in the next post

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.