Ruby Developer Question:

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

Ruby Developer Interview Question
Ruby Developer Interview Question

Answer:

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


Previous QuestionNext Question
Tell me what is the difference between calling super() and super call?As you know ruby provides four types of variables. List them and provide a brief explanation for each?