Skip to content

stevenjlance/2.1.Conditional-Statements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conditional Statements

Conditional statements (often simply referrerd to as if statements) are a fundamental concept in all programming languages. Let's suppose we want to run a certain set of code only if certain conditions are met, we would write a conditional statement to achieve this!

if(CONDITION_YOU_ARE_CHECKING) {
	// Code you want to run

}

For today's class, we will be practicing writing our very first conditional statements!

Task

CHALLENGE #1: Draw a square that is red if the mouse's x position is less than 300, otherwise draw a blue square.

CHALLENGE #2: If the mouse's x position is larger than 200, draw a large square. If the mouse's x position is smaller than 200, draw a tiny square.

CHALLENGE #3: If mouseX is on the right side of the screen, shrink the ellipse to 20. If mouseY is on the bottom half of the screen, change the fill to red.

CHALLENGE #4: If mouseX is less than 100, turn the circle one color. If the mouseX is larger than

CHALLENGE #5: Create your own design using the following requirements:

  • Create more than two variations by writing a conditional statement using the x position and y position of your mouse.
  • You can change the color, size or position of a shape.`
  • You can adapt a previous sketch and add interactivity to it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors