Give 3 examples of commands!
Any of the 3: moveForward(), turnLeft(), turnRight(), toggleSwitch(), collectGem(),
How do we declare a for loop?
for
What is a term that will states the answer is true or false?
Boolean
What are the 3 logical operators?
" || ", " && ", " ! " (OR, AND, NOT)
How do we define a while loop?
while
What do you call a collection of commands that are grouped together and given a name?
Function
How many times does a for loop run for?
Whatever the end number/end condition is that we state
How will a conditional code run?
If the condition is true
How many conditions need to be true when using &&?
All conditions
What do you call a loop that never ends?
Infinite loop
What is the code to delcare a function?
func
What is the term for using a loop inside another loop?
Nesting
What are the 3 conditionals we use?
if, else-if, and else
How many conditions need to be true when using " || "?
At least 1 condition.
How do we define the end of a while loop?
When the condition is false
Write me a for loop if you are walking in a square
for i in 1 ... 4 {
moveForward()
turnRight()
}
What type of situation would we use a for loop?
When we want to repeat the code for the exact number of times, consecutively.
In Playgrounds, what is the starting word for a condition?
What characters are used to contain a block of code?
Curly Braces/Brackets
When will you use a while loop rather than a for loop?
When you do not know how many times to run your loop