Answers

Question and Answer:

  Home  Ruby Developer

⟩ What is the Notation used for denoting class variables in Ruby?

In Ruby,

☛ A constant should begin with an uppercase letter, and it should not be defined inside a method

☛ A local must begin with the _ underscore sign or a lowercase letter

☛ A global variable should begin with the $ sign. An uninitialized global has the value of “nil” and it should raise a warning. It can be referred anywhere in the program.

☛ A class variable should begin with double @@ and have to be first initialized before being used in a method definition

 127 views

More Questions for you: