IF Statement Worksheet

Question 1

Why is an IF statement known as a control structure?

It allows a programmer to control the flow of execution in a program by condisitonally choosing which block of code to execute based on whether a certain condition is true or false.

Question 2

There are other control structures in JavaScript that we'll be learning about soon. Use your google skills to look up the other control structures in JavaScript and list them below.

Conditional statements, Loop statements, jump statements

Question 3

What is a boolean expression?

A true or false statement

Question 4

What is the 'equality operator', and what is it used for? How is it different from the assignment operator?

it is a double equal sign so the code doesn't try to assign it to a variable.

Question 5

Why is it important to properly indent your code when writing IF statements?

So it is clarified. If not indented properly, the interpreter might not understand it.

Question 6

What is a code block in JavaScript?

A group of statements enclosed within curly braces.

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.