Beginning of dialog window. It congratulates you on completing this exercise. Escape will cancel an close the window.

Congratulations, you've completed this exercise!

Would you like to...

You can always navigate to any page at a later time.

Beginning of dialog window. It asks that code be input before running.

There isn't any code

Type in some code and then press the run button to see what it does

Part 2: Sayin' Stuff

Number Varibles

Number Variables

Another type of variable often used in programming is a real (or decimal) number. In Quorum to create this type of variable we use the keyword number.

A number variable holds numeric values that can include decimal places such as 8.3439 or 42.0 or even 19.

Unlike text variables, we never use double quotes when storing a number, we just type it.

Create a number variable with the following code: number pi = 3.14159 then move to the next slide.

Arithmetic with Number Variables

We can do arithmetic calculations with number variables, just like we would on the numbers themselves.

The computer substitutes the actual number in the variable into the formula and performs the calculation.

For example, if we make a new variable that holds the radius of a circle, then we can calculate its area using the formula area = pi X radius X radius. On a computer, the multiplication operator is the *.

Create a variable to hold your circle's radius: number radius = 3 and then calculate the area: number area = pi * radius * radius

Make the Computer Talk with: Say

Quorum has a built in feature to instruct the computer to say things out loud. This is done by using the keyword say followed by whatever we want it to say.

Just like with output statements, the computer can say the contents of a variable or a string that we type in.

Note: Say statements may not work with all web browsers.

Tell the computer to say the result of the area calculation you just completed by typing a new line: say "The area is " + area followed by output "The area is " + area and then Run your code.

Additional Information

There are 5 main operators when using numbers: + (addition), - (subtraction), * (multiplication), / division and mod (modulus).

The modulus operator is used for finding the remainder of a division operation, for example: 15 mod 10 will give us a result of 5.

One example of how to use the modulus operator is to deterimine if a number is even or odd: evenNum mod 2 equals 0 and oddNum mod 2 equals 1.

When using say or output statements, you can concatenate (add) things to be output one after another using the + operator, just like in the previous slide.

Try it Yourself

Next Tutorial

In the next tutorial, we will discuss Hour of Code Part 3, which describes first steps in Quorum.