Ruby Variables
Variables need no declaration. Local variables are lowercase, @name is an instance variable, @@name a class variable, $name global and CONSTANT uppercase.
Example
name = "Ada"
age = 21
MAX = 100
puts "#{name} #{age} #{MAX}"
puts name.class, age.classResult
Ada 21 100 String Integer
Exercise
Instance variable prefix.
name = "x"Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.