Search This Blog

Friday, 1 December 2017

Post 1 Selection statements

Selection statements work when a required outcome is desired to produce a specific output if this outcome is not delivered to the selection statement something else will happen that the selection statement would've been told to do.

An Example...



Something else to talk about is "Case Select" statements.
Case select statements is another way for a programmer to test whats inside of a variable but is mainly used when you know that there is only a select amount of things that can be in the variable.

An Example...

                    CASE COMMAND$ OF
            WHEN "Move west","Move left", "Go to the door on the left","Go to the door to the west": THEN ROOM = 2
            WHEN "Move east","Move right","Go to the door on the right","Go to the door to the east": THEN ROOM = 3
            WHEN "Move north","Move up","Go to the door to the top of the room","Go to the door to the north": THEN ROOM = 4
            WHEN "Move south","Move down","Go to the door to the bottom end of the room","Go to the door to the south of the room": THEN ROOM = 5


No comments:

Post a Comment

Post 6 Sequence,selection and iteration

Sequence Sequencing is when the computer will run the code it receives, one line at a time from the top to the bottom of the requested prog...