Computers calculate, compare and copy data, and the compare instruction is the primary branching logic. 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.
calculate or copy
calculate or copy
compare A with B, if equal "go to" EqualRoutine
calculate or copy
calculate or copy
calculate or copy