Comp 101 Printing

Printing Variables

Printing variables can seem a bit tricky at first. For example, when we run the following code:

Let zodiacNumber = 1;

zodiacNumber is printed instead of 1. Why is this?

When we print a statement within quotation marks, even if it is the same as a variable name, we are not actually printing the value of the variable. Instead, we are telling our computer to print literally the words within the quotation marks, in this case zodiacNumber. If we want to print the number value of the variable zodiacNumber, we should instead be writing:


Notice the lack of quotation marks.

Now 1 is printed to our screen! Yay!

How would you print the value of the zodiacSign variable?
let zodiacSign = "Aries"