control structure

'''Control structures''' are constructs used to control the logic of a program based on a given condition. Control structures typically use branch or [[loop?]] statements. Code is typically arranged into [[block?]]s within the control structure.

_Conditional Branching_

The following example shows a [[block?]] of code being used as a conditional branch:

  if (guess == 6) {
    print "Wow! That was a lucky guess." # we are within an if block here
  }

_Loops_

The following example shows a [[block?]] of code being used within a [[loop?]]:

 for (l = 0; l <= 9; l++) {
   print l   # This runs ten times
 }