Variables and Types


Variables are defined like this

myFirstVariable = "I made a variable!"

A variable can be thought of as an pointer to find data. Variables tell the computer program where the data is located in memory. This is similar to using an address to find a house. When you use a variable, you are storing information and it's location to be referenced or used in a computer program.

There are three major types of data you can set variables to.

=begin
in order,
a string,
a boolean,
and a number
=end
aString = "I'm a string!"
aBoolean = true
aNumber = 42

Exercise

Define three variables, myString, myBoolean, and myNumber, and set them to "I'm programming!", "true", and "5".