Tutorial

Variable naming

Ok, let's slow down and learn some basics about variable names

  1. Global variables start with '$'
  2. Class variables start with '@@'
  3. Instance variables start with '@'
  4. Local variables, method names, and method parameters start with a lower case letter
  5. Class names, module names and constants start with an uppercase letter
  6. Variables names are composed of letters, numbers and underscores
  7. Method names may end with "?", "!", or "=". Methods ending with a "?" imply a boolean operation (eg, "instance_of?"). Methods ending with "!" imply something dangerous, like strings being modified in place (eg, "upcase!")

你可能感兴趣的:(RIA)