Explain the use of global variable $ in Ruby
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.
Explain the use of global variable $ in Ruby
If you declare one variable as global we can access any where, where as class variable visibility only in the class