function quadrupleNumber(x){
var quadX = 4 * x;
println(quadX);
}
What is the parameter of the function quadrupleNumber?
x
Which function begins each program?
the start function
Which statement will call a function animate every 50 milliseconds?
setTimer(animate, 50);
Why do we write functions?
Make our code easier to understand by giving a readable name to a group of instructions
Avoid writing repeated code
Make our code reusable
var coolCircle = new Circle(30);
What does the 30 represent?the radius
FREE 200 POINTS GO AGAIN!!!
FREE 200 POINTS GO AGAIN!!!
True or False:
Naming functions properly is very important.
true
How would you stop the timer in a program that contained this command:
setTimer(draw, 50);
stopTimer(draw);
FREE 200 POINTS AND GO AGAIN!!!
FREE 200 POINTS AND GO AGAIN!!!
What are the coordinates in the upper left corner of the screen?
(0,0)
Karel is facing east. How many times does Karel need to turn left to face west?
twice
Functions allow us to break down our program into smaller parts, and make the program _________.
easier to understand
FREE 300 POINTS GO AGAIN!!!
FREE 300 POINTS GO AGAIN!!!
If we want to draw a circle using our helpful drawCircle function at position (300, 400) with a radius of 40 and color blue, which is the correct function call? You don't need to say the word function...you aren't defining it you are calling it.
function drawCircle(radius, color, x, y)
drawCircle(40, Color.blue, 300, 400);
What is wrong with this command?
var rect = new rectangle(30,120);
"rectangle" should be capitalized
In a graphics canvas, what are the coordinates of the center of the canvas?
getWidth() / 2, getHeight() / 2
What are you doing when you are defining a function?
You are specifying the instructions (writing the code) for that function.
Sorry you lost your turn.
Sorry you lost your turn.
SORRY YOU LOST YOUR TURN!!!
SORRY YOU LOST YOUR TURN!!!
What function do you need to call to get the width of the screen?
getWidth();
What three programming languages do web developers often use together
HTML
JavaScript
CSS
What are you doing when you are calling a function?
You are causing the action/function to actually happen.
Will this statement determine if ball is hitting the left edge of the window?
if(ball.getX() - ball.getRadius() <= 0){
//ball is hitting left edge
}
yes
How many return values come out of the function sum?
function sum(first, second){
var result = first + second;
return result;
}
one
What are the coordinates of the top right corner of the screen?
getWidth(), 0