Introduction

This section builds on the concepts of the Simple Sequence Structure. Here you will learn about the branching logic; branching logic uses the results of a boolean test; a test that will return true or false. Branching logic is one of the most common coding structures; almost every application has some form of a branching structure in its code. These concepts will be used throughout this course.

Relational Operators

The boolean test uses one or more of the following relational operators:

Relational Operator Meaning
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
!= No equal to
== Equal to

Note: The single = symbol is an assignment opertor!

Logical Operators

The boolean test uses zero or more of the following logical operators:

Logical Operator Meaning
&& A logical AND; both sides of the expression MUST be true for the condition to be true
|| A logical OR; if either side of the expression is true, the condition is true
! A logical NOT; negates the logical result, i.e., if the condition is TRUE, then it will negate it to be a FALSE

Coding Topics

You will learn about the following:
If-Then-Else
Switch Structure

Practice Problems

Decision Making Problems 1
Decision Making Problems 2
Decision Structure Programming Exercises

CPSC1012 Home