Commands/Functions
For Loops
Conditional Code
Logical Operators
While Loops
100

Give 3 examples of commands!

Any of the 3: moveForward(), turnLeft(), turnRight(), toggleSwitch(), collectGem(), 

100

How do we declare a for loop?

for

100

What is a term that will states the answer is true or false?

Boolean

100

What are the 3 logical operators? 

" || ", " && ", " ! " (OR, AND, NOT)

100

How do we define a while loop?

while

200

What do you call a collection of commands that are grouped together and given a name?

Function

200

How many times does a for loop run for?

Whatever the end number/end condition is that we state

200

How will a conditional code run?

If the condition is true

200

How many conditions need to be true when using &&?

All conditions

200

What do you call a loop that never ends?

Infinite loop

300

What is the code to delcare a function?

func

300

What is the term for using a loop inside another loop?

Nesting

300

What are the 3 conditionals we use?

if, else-if, and else

300

How many conditions need to be true when using " || "?

At least 1 condition.

300

How do we define the end of a while loop?

When the condition is false

400

What is one reason we might define a function?

Reusability, clean code, short code, condensed code

400

What type of situation would we use a for loop?

When we want to repeat the code for the exact number of times, consecutively. 

400

In Playgrounds, what is the starting word for a condition?

"is"
400

What does the following logical operator do: " ! "?

The opposite of the condition must be true to run.

400

When will you use a while loop rather than a for loop?

When you do not know how many times to run your loop

500

What characters are used to contain a block of code?

Curly Braces/Brackets

500

Write me a for loop if you are walking in a square

for i in 1 ... 4 {

 moveForward()

 turnRight()

}

500

Locate the bug:

for i in 1 ... 16 {

 if isongem {

 collectGem()

turnLeft()

} else {

moveForward()

}

isOnGem

500

Write this pseudocode in Swift: "If there is an open switch, and I am blocked, I will close the switch and turn right, else I will collect the gem and turn around 180 degrees."

if isOnOpenSwitch && isBlocked {

 toggleSwitch()

 turnRight()

} else {

 collectGem()

 turnLeft()

 turnLeft()

}

500

Write me a loop for this scenario: "While the conveyor bely is on, I will put grocery items on belt"

while isBeltIsOn {

 putItemOnBelt()

}

M
e
n
u