What is a loop?
A way to repeat code.
move(); is an example of a _________________
What is Command
Which of the following is not a condition? a. frontIsClear b. turnLeft(); c. isFacingNorth
What is B?
Why use a for loop instead of a while loop?
Repeat something a fixed number of times.
How many left turns make a right turn?
3
What is a code comment?
A way to give notes to someone who is reading your code and explain what is happening
What is the point of using an if statement?
To only run condition if a condition is true.
Why use a while loop instead of a for loop?
Repeat something as long as a condition is true.
How do you start a single line comment?
// double backslash
Why do we indent lines of code?
Helps us read loops, conditions, etc.
Debug:
for (var i = 0 i < 5 i++) {
move();
}
Missing semicolons. for (var i = 0; i < 5; i++)...
Which one of the following is not a command that super Karel knows? a.) putBall b.) turnAround c.) turnRight d.) Karel knows all of the above
D.
How do you start and end a multi-line comment?
/* Comment */
Debug this code:
if (frontIsClear) {
move();
}
Missing parentheses. if (frontIsClear())...
Debug:
while (frontIsClear())
move();
}
Missing opening curly brace. while (frontIsClear()){...
What is the command for Karel to pick up a tennis ball?
takeBall();
What is wrong with this function?
function SOMETHINGWRONG(){...}
What is function buildTower(){ putBall(); putBall(); putBall(); }
What does the 'Else' part of an 'If/Else' statement do?
Only runs if a condition is not true.