A value that is either true or false.
What is a Boolean variable?
Write a code using the OR operator that will run a TRUE value. (You do not need to use function start)
What is
var (name) = true/false
var (name) = true/false
one variable is true
19 == 19 || 19!=8
What is true?
This is used to make logical associations between boolean values
What is Logical operator?
Write a code using the AND operator that will run a TRUE value. (You do not need to use function start)
What is
var (name) = true
var (name) = true
both variables must be true
var SIDE_LENGTH = 100;
function start(){
var rectX = getWidth() / 2 - SIDE_LENGTH / 2;
var rectY = getHeight() / 2 - SIDE_LENGTH / 2;
var square = new Rectangle(SIDE_LENGTH, SIDE_LENGTH);
square.setPosition(rectX, rectY);
square.setColor(Randomizer.nextColor());
add(square);
}
What is Random color square?
A constant that has the specific purpose of being the value that breaks out of a loop.
What is Sentinel
This code will run:
var pokemonPikachu = true
pokemonPikachu = !pokemonPikachu
What is false
NotpokemonPikachu
var i = 10;
while(i >= 0){
println(i);
}
What is infinite loop (program crash)?
Lets us repeat code as long as something is true
What is While Loop?
This code will run:
var show = readBoolean("Do you want to see a movie?");
var games= readBoolean("Do you want to play games?");
var havePlans = show || movie;
println("Do you have any plans?" + havePlans)'
What is
Have plans one is true.
var i = 10;
while(i >= 0){
println(i);
i--;
}
What is countdown 10 to 0?
This flips a boolean value, or take the opposite of a boolean value.
What is negate?
This code will give this solution
x==4
y==3
z==8
(z % y) + 4
What is 6
var NUM_CIRCLES = 30;
var BIG_RADIUS = 150;
function start()
{
// Calculate constant values:
var xPos = getWidth()/2;
var height = getHeight();
var increment = BIG_RADIUS / NUM_CIRCLES;
// Draw circles:
for (var i = NUM_CIRCLES; i > 0; i--)
{
var circle = new Circle(i * increment);
circle.setColor(Randomizer.nextColor());
circle.setPosition(xPos, height - circle.getRadius());
add(circle);
}
}
What is circle in circle? |