Loop will keep the instructions going on forever given the defined condition. It is crucial when we want to utilize the power of computing devices to calculate huge amount of data that we cannot do. There are three basic loop methods: for loop, while loop, and do while loop. screen-shot-2016-12-27-at-6-43-12-amscreen-shot-2016-12-27-at-6-42-50-amscreen-shot-2016-12-27-at-6-42-39-amThe exercises ask us to create a loop that is able to show all the even or odd number to a user-defined point. Therefore, it should keep looping util a point where user defines. The final product of the exercise is presented below. screen-shot-2016-12-27-at-7-17-43-am

The flowchart below shows the previous program that can output all of the even or odd number to a user-point. The key elements in the program is looping; it will continue to loop if the value is smaller than the user-defined.

img_4120

Type safe also uses loop. It will keep asking for input if it does not receive one valid inputScreen Shot 2016-12-27 at 7.53.58 AM.png

To apply the concept into real life, we can write an program that resembles the order menu in a restaurant. screen-shot-2016-12-27-at-7-59-33-am