But there are also procedures in which the order of

This preview shows page 8 - 10 out of 31 pages.

But there are also procedures in which the order of steps is unimportant. Often in such procedures, a conventional orderemerges to avoid confusion. An excellent example in the U.S. context is addressing letters for mailing. Every school child knows that you do it in this order:First name Last nameHouse NumberStreet nameCity, State Zip code CountryOddly enough, this conventional order is exactly the reverse of how the address is examined at the various postal distribution points in the mail system. The post office at the point of origin would look at the country and put the letter in a pile for international mail. The distribution center in the destination country would look at the zip code and perhaps state. The local post office would examine the street address and place it in the proper mail carrier's route, and the mail carrier, upon arriving on that street, would place it into the mailbox bearing that address. Finally, whoever checked the mail at the house would look at the name and givesthe letter to the person it was addressed to. In some countries the conventional order follows the logical task order in addressing envelopes. In Russia, for example, letters are addressed in exactly the opposite order to the U.S. convention.Example: You want to clear your screen of all buttons and fields, show a field with text, and wait for the user to click, then hide the field and show the former ones.To work correctly, not only do all the commands have to be there, they have to be in the right order.
FOR FULLNOTES CALL/TEXT:0724 962 4779Structured ProgrammingII.Conditional structures (Do certain things based on a true or false, yes or no decision.)These provide for one outcome or sequence of events to be executed if a statement is true, and another outcome or sequence of events to be triggered if the statement is false.In most programming languages these structures take the form if . . . then . . . else. The One Potato, Two Potato game uses lots of conditional decisions. Ifthe counter lands on your fist on the word "more" thenyou must remove your fist from the circle.Ifboth of your fists are knocked out of the circle thenyou are out of the game.Computing examples:Example 1: Ifa word exists in a list, thenprint it out,Elsetell the user that the word does not exist.Example 2: Ifa sentence contains the word "silly" then put that sentence into the silly list. Elseif it doesn't contain the word "silly" then put it into the serious list. III.Looping structures(A list of instructions to do more than once.)Used to make the computer repeat a certain command or sequence of commands. The loop may run for a predetermined number of times, until a certain condition becomes true, or as long as a certain condition remains true.Here are some ways that looping might be done:Do the following 20 times.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture