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