Understand the idea
Validation checks a stated rule. For a whole-number count from 0 to 20, negative values, fractions and values over 20 should be rejected.
WORKED EXAMPLE
Input 12 is numeric, whole and within 0-20. It is accepted. Input 2.5 fails the whole-number test.
Watch it step by step
Step 1 of 4Receive
Example input is 12.
Choose Play to advance steps automatically.
Read or choose any step
- Receive
Example input is 12.
- Type
Check that the value is numeric.
- Rule
Check whole number and 0 ≤ value ≤ 20.
- Result
Accept 12; reject 2.5 for this count.
TRY BEFORE CHECKING
Exercises with feedback
MAKE SOMETHING YOU CAN EXPLAIN
Your practical challenge
Draw a validation flowchart and test -1, 0, 12, 20 and 21. Include a fractional case.
These ticks are your self-review. They do not automatically assess project quality. Ask an adult or partner to review what you can show.
Use the skill in a new situation
Explain why numeric text may need careful conversion.