Computers calculate, compare and copy, and the compare instruction is the primary branching logic. The compare evaluates two items of data. One path is taken if the items are equal in value or one is higher or lower than another, and if not, the next instruction is typically executed (see below).
In the following example, the "go to" is a branch instruction. When there is no branch, instructions are executed sequentially. See
branch prediction and
3 C's.
execute calculate or copy instruction
execute calculate or copy instruction
compare A with B, if equal "go to" EqualRoutine
execute calculate or copy instruction
execute calculate or copy instruction
execute calculate or copy instruction