Explore BrainMass

Looping and Case Statements

1. When using Case statements, what would happen if you did not "Break?" Please give an example and explain.

2. Where, in your everyday life, would you use all of the looping techniques,

? Pseudocode for looping structures
? Operators continued
? The while loop
? The do while loop
? The for loop
? break and continue statements
? System calls

Give examples. (Please do not use any computer languages in your examples)

Example: While hair is dirty, Shampoo hair - Apply small amount of shampoo to hair, lather, rinse, and then repeat until clean. (Please be more detailed)

Solution Preview

1. If the "break" statement is not used in a case-switch structure, all the options will be gone through and evaluated instead of just the single, relevant one, which will render the program inefficient.

2. Pseudocode for looping structures
Suppose that I have to drive from my house to the post shop, bank, local library, children's crèche, a friends place and my mom's house. I do not exactly know the way (as I will check it on my GPS system when driving), but I have a general idea what way to go to visit all these places and I make a rough mental map in my mind about driving directions. This is an example of a pseudo code.

? ...

Solution Summary

462 words give real life examples of loop behaviour to illustrate the technique in computing.