Ruby Developer Question:
Download Job Interview Questions and Answers PDF
What is the Notation used for denoting class variables in Ruby?
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
☛ 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
Download Ruby Developer Interview Questions And Answers
PDF