Respond to each post in 150 words.
1 of 1
Hello All,
This week we are looking at the three main structures used in programming. These three types of structures are a basic unit of programming logic. Based on each type, the programming can do different things. The sequence structure is when the programming performs tasks in a repetitive order. One action is done, then the next, then the one after that and so on and so forth. It is a set of instructions that are in order. An example is a program that moves through steps, such as a tutorial for a game. It shows you how to control the character, then how to equip and use items, then how to perform combat moves until you are fully able to play the game. Think of it as a highway with zero exits. The nest structure is the selection structure. This type of structure allows a user to make choices and ask questions. This is like being on a modern-day highway with exits. When a choice is made or a question input, the output changes based on that information. The example I thought of with this one is the quest in the game we are theoretically playing. You must collect 4 eggs on the quest, and upon collecting each egg, the programming checks if the criteria have been met to complete the quest yet. When 4 eggs have been collected, the program allows the player to turn in the quest. The final type of structure used in programming is the loop structure, sometimes known as the iteration. The loop looks for input matching certain criteria. If the criteria are not met, the program continues through the process and exits the program without any actions. If it is met however, the process continues to the next step, then it is checked again. When the criteria are finally met, the program will be done. The example in our video game is a high-level item that can only be worn at level 15. When the criteria, level 15 is not met, it will not allow the piece to be equipped. However, when the character’s level reaches 15, it would now be available for equipping.
2 of 2
Hello class,
There are 3 different structures in programming, can you name them? They are as follows, sequence, selection and loops. First one is sequence, sequence is default mode, or as I like to call it auto pilot. I think of it as auto pilot, because it is the same thing, one step after another, its like plugging in coordinates on a GPS to your location, you must turn down all the correct streets to get to your final destination. Same thing here, if you miss a step, the program will be lost.
Secondly, is selection, selection is choosing which route to go, which one is the most fluid and precise. This step makes that decision. Often also called ‘branching” and choosing between two different or more alternate paths. An example of selection would be, going back to the GPS, there are always alternate routes, avoid highways, avoid tolls, avoid heavy traffic, this is the same kind of logic.
Thirdly is looping. Looping consists of repitition, you are repeating the same steps over and over again. A great example of looping is when you are using your MP3 player and you have a certain group of songs that you like listening to and are in a playlist. You set it to “play back” so it continues to play those songs over and over again, causing a looping effect.
There are so many different examples to protray of programming structures, but these were the ones that came to mind as I was doing this.