Skip to main content
Logo image

Section 9.1 if Statements

We are ready for a really important and powerful new concept: the ability to create computer instructions that are executed only if certain conditions are met. Let’s take a look.

If you cannot see this codecast, please click here.

Check Your Understanding Check Your Understanding

1.

    Which of the following shows the correct syntax for an if statement?
  • if (cloudy) printf("It's not sunny :-(");
  • Correct
  • printf("It's not sunny :-(") if (cloudy);
  • Not quite - try again!
  • if (cloudy) printf("It's not sunny :-(")
  • Not quite - try again!
  • if cloudy printf("It's not sunny :-(");
  • Not quite - try again!
Hint.
Review the video if you are stumped.