Ruby Variables

Ruby Variables

The Ruby Variables syntax and examples.

Local Variables syntax

Local Variables 
variable_name = variable_value

Global Variables 
$variable_name = variable_value

Class Variables
Instance Variables

Local Variables example

irb(main):001:0> x=1
=> 1
irb(main):002:0> x
=> 1
irb(main):003:0>

Variables example

x=1
puts x
y='test rubyyy'
puts y