If/else statements

An if-statement could be something like

if (it is raining) { bring an umbrella }

A computer following these instructions would take an umbrella if it were raining, and would not if it were not raining.

We can also use the word "else" to tell the computer to do if something isn't true and say something a little more complicated:

if (it is raining) {bring an umbrella} ELSE {bring a coat}".

If/else statements courses

Intro to Scratch: Game Development

Build your own version of The World's Hardest Game and learn the Scratch programming language while doing it!

JavaScript Game Design

Learn the fundamentals of JavaScript by building your own game

JavaScript for Scratchers

In this course we will transition from block-based Scratch programming into text-based JavaScript!

If/else statements lessons

Intro to Scratch Games 3: Collisions and Solid Walls

In this lesson we are going to learn how to code solid walls and check for collisions between sprites.

Inputs and Logic

Learn to use if statements and keyboard input to control your character

JavaScript for Scratchers 3: Animation

In this lesson we will learn about variables, if statements, operators, and the draw function so we can make things move around using JavaScript!

Related Links

No links found
About If/else statements

A logic structure that let's us tell something to only happen "if" something is true

Badge

If/else Statements