A function that retrieves an integer from the user
readInt()
Code that draws cir1 on the canvas
add(cir1);
An operation that's true when both of its booleans are true
and &&
Randomizer.nextBoolean() generates this many possible values
2
Use this when we want to repeat an action a definite amount of times
for loop
The three ways you can print text to a console without expecting any input
print, println, console.log
The default size of the canvas
400x600
An operation that's true if its corresponding boolean is false
Not !
Generates a random number from 5 to 15, inclusive
Randomizer.nextInt(5, 15)
Karel turns until they face south
While(notFacingSouth()){
turnLeft();
}
Mouse events use this variable to represent your cursor
e
When making a new Circle object, this is your single argument.
radius
The boolean order of operations
Parentheses (), not !, and &&, or ||
When two pieces of code have the same outcome, regardless of input
Equivalence
The term for when a loop is inside of another loop
Nested loop
How many stars does this print?
for(let i = 7; i < 5; i++){
print("***");
}
0
When making a new Rectangle object, these two values are used as your arguments.
Width and height
Simplify a || !a
true
Immediately halts the loop that it's inside
break
Function that runs automatically
start()
Write code that asks the user for a number. Print "yes" if that number has one or two digits.
let x = readInt("gimme a number");
if(x > -100 && x < 100){
print("yes");
}
The coordinates for the center of any canvas
(getWidth() / 2, getHeight() / 2)
!(a && b) is equivalent to this
!a || !b
Can generate 10, 20, 30, 40, or 50 at random
Randomizer.nextInt(1, 5) * 10
Final AP Exam registration day