Hour of Code: Code with Mary

Part 7: The End of the World
Quorum Review
Hour of Code Review - Variables
Variables are containers for information.
To create a variable, declare the type of the variable followed by the name.
To assign a value into a variable, use the = operator.
There are four main types of variables in Quorum, each for specific kinds of data:
text for any number of characters
integer for positive and negative whole numbers
number for values with a demical point
boolean for true or false values.
When creating a variable name, always start it with a letter (usually lower case, but this is not required).
More information on variables can be found here.
Hour of Code Review - Output/Say Statements
An output statement will print text on the screen.
A say statements will instruct the computer to speak the expression aloud.
Note that some browsers do not support the say feature in Quorum's online mode.
Hour of Code Review - If Statements
Use an if statement to have the computer decide whether or not to run certain code.
An if statement requires a condition to be evaluated (variable > 5, variable = 5, etc.) and an end statement to mark the end of the code block.
An if statement can optionally contain an elseif statement to test another condition or a default else statement (or both) to handle any other possibility not listed.
More information on if statements can be found here.
Hour of Code Review - Repeat
When we want to run a section of code repeatedly, we use a repeat statement to create a loop.
Like an if statement, a repeat statement requires a condition for stopping and an end statement.
We specify the condition for stopping the loop by using one of these formats:
repeat {number} times,
repeat while {condition} or
repeat until {condition}.
More information on repeat loops can be found here.
Hour of Code Review - Actions
Actions are used to reduce the amount of duplicate code in a program and to make it easier to read.
To create an action, use the keyword action followed by the action's name, which usually starts with a capital letter.
The computer always starts executing a program at the Main action, but if the program has only one action, Quorum will automatically insert the program code into a Main action.
If a program has actions besides Main, the action Main must be defined somewhere in the program.
To execute an action at a particular point in the program, type the name of the action followed by parentheses.
More information on actions can be found here.