Int+2+Input+Validation

Introduction
Input validation is the process of ensuring that any data which the user has entered is within a reasonable range or set. For example, consider a program which asks the user to enter which day of the month their birthday falls on. Answers such as 50, 1017 or -10 are clearly not valid responses. Input validation should be used to inform the user that their input is not within an acceptable range, and should generally ask them to re-enter.

We can devise an algorithm for the above date problem as follows:

1. get date from user 2. repeat while date < 1 OR date > 31 3. get date from user 4. end while loop

5. //main code goes here//

The algorithm above will work for an event-driven programming environment such as Real Basic because the input is via an edit field on the main screen.

Task 1
Year Group

Task 2
Goal of the month

Task 3 (optional)
Input Validation (Scratch)