Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Begin Age
- Int Age with range 0..120;
- Print "Hello, how old are you?";
- Get(Age);
- If Age<18 Then
- Print "Ha! You're just a baby";
- Elseif Age<60 then
- Print "Working hard?";
- Else
- Print "Now take it easy old fella!"
- End if
- Onerror constraint_error =>
- Print "Sorry, only ages 0 through 120 are accepted.";
- End Age
- As in BASIC, the input-output routine is built-in: no need for that include. The procedure & variable definitions are simplified while conveying same meaning. Other changes are a mix of Ada, BASIC, and Wirth languages. Print is closer to how people think. Could ditch the Then's and End If by using braces. However, I think this is more readable and we all agree that's more important than saving programmers typing. I modified error handling to be simpler. Kept the function ending style. So, this is more readable than the original while taking fewer lines of code.
Advertisement
Add Comment
Please, Sign In to add comment