• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Conditionals > The if Statement

7.1. The if Statement

The if statement is your everyday, all-purpose conditional. We can use an if statement to create a two-pronged branch in our code, like a fork in the road. The if statement contains one or more substatements that are executed only when the specified condition is met. The if statement has the following syntax:

if (condition) {
  substatements
}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint