Cloudbook: C

  1. Home
  2. Control
  3. Branching ← prevnext →
Branching
  1. Statements can be collected into blocks, and the running of the blocks controlled by the value of a logical expression. more ...

    LiveC: A puzzle — rearrange the code. more ...

    Multimedia presentation goes here.
  2. The meaning of the if statement is that it runs a block of code only if a logical expression has value true. more ...

    LiveC: If statements and logical expression, translations. more ...

    Multimedia presentation goes here.
  3. The else clause is an optional part of the if statement. It else clause follows an if statement and runs its code block only if the controlling expression evaluates false. more ...

    LiveC: An example of if/else, and an exercise in nested loops. more ...

    Multimedia presentation goes here.
  4. The switch is a multiway branch. It controls a block containing a sequence of case statements that mark entry points to the block with an integral value. The switch operand is evaluate and control passes to case statement of equal value.

    A default: case exists which is the entry point of the block when no case matches the operand value.

    It is a common error to assume that the case statements mark ending points as well as entry points to the block. Usually break statements are required to get the desired behavior. more ...

    LiveC: An example of if/else, and an exercise in nested loops. more ...

    Multimedia presentation goes here.
  5. Goto statements, and labels

    LiveC: An example of if/else, and an exercise in nested loops. more ...

    Multimedia presentation goes here.
Copyright 2015, 2017 Burt Rosenberg. All Rights Reserved.