Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 635 Bytes

File metadata and controls

14 lines (10 loc) · 635 Bytes

Notes: Variables

In programming, we often need to retain values that are the result of computations or commands. Maybe we want to refer to the values later, or maybe calculating the value was very time consuming or complicated. A variable is a construct which has a name that refers to a specific value. Variables are declared by choosing a name and using the = command to assign a value to it.

A variable can have any type of value assigned to it. Here are some examples of creating a variable:

dog_name = "Rosa"
cat_name = "Raquel"
dog_age  = 7
cat_age  = 11

favorite_color = gets.chomp