If the user did not type in the correct response, then simply prompt again. You should use the IF command with with pattern matching and the Not operator making sure incorrect values are processed to the right of the IF command. Processing exceptions to the right of the check keeps this code out of the normal top-down flow of a routine. Sometimes this makes the line long. If this happens, try to use block structuring.

Test this code and make sure it works before moving on. Always do this before proceeding to the next step.

If the query value is incorrect, we need to immediately check for the convention entries: "^" and null. If the "^" is entered, go to the previous query. If a null was entered, simply quit at this point. Later on, entering null will take on a different meaning. What is the "previous query" mean at the first query PNUM? Simply quit at this time.

Notice we used block structuring to make the lines less long and readable. Some would argue that this increases processing which is true. However, under the circumstances where this code will not be processed in the normal flow of the routine, this is quite acceptable.

Also, take note of the argumentless commands Quit and Do. When a comment or command follows them, two spaces must be used. Positionally, this simply means the arguments are missing.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum