This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Algortihms – Part 2 28/02/2008 13:16:00 ← Condition Branch • So far, in the method part of our algorithms, the instructions have been executed sequentially • However, sometimes we need to vary the order of execution of the instructions. The order will be determined by the value of a condition • We will test to determine whether the condition is true or false o If the condition is true , we will execute certain instructions o If the condition is false , we will executed other instructions • But first, let us define a block as group of related instructions o A block can contain one or as many instructions as we want BLOCK 1-------------- Get X Get Y Let Z = X + Y Give Z BLOCK 2-------------- Let X = A + B * C /D ← ← Block • The key feature of a block is that it has only one entrance (one way to come in) o By executing the first instruction in the block...
View Full Document
- Fall '09
- Let Value