ruby class variable code example
Example 1: ruby class variable
class Customer
@@no_of_customers = 0
end
Example 2: class ruby
Classes in Ruby are first-class objects—each is an instance of class Class . When a new class is created, an object of type Class is initialized and assigned to a global constant ( Name in this case). Classes, modules, and objects are interrelated.
Example 3: variables in ruby
var_name = "value"