Explain the use of global variable $ in Ruby

Answer

The global variable is declared with $ prepended. It has full scope in the application. These variables can be used anywhere within an application.

For Example:

$departmentName = “Operations”

Proper care is to be taken when using global variables, as they can also be changed from anywhere within the application, which leads to bug tracking later. This process can make the bug tracking more difficult.

All ruby Questions

Ask your interview questions on ruby

Write Your comment or Questions if you want the answers on ruby from ruby Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---