⟩ As you know ruby provides four types of variables. List them and provide a brief explanation for each?
The four types of variables in Ruby are as follows:
☛ Global variables begin with $ and are accessible from anywhere within the Ruby program regardless of where they are declared—it stands to reason that they must be handled with care.
☛ Local variables begin with a lowercase letter or an underscore. The scope of a local variable is confined to the code construct within which it is declared.
☛ Class variables begin with @@ and are shared by all instances of the class that it is defined in.
☛ Instance variables begin with @ and are similar to class variables except that they are local to a single instance of a class in which they are instantiated.