Re: Tutorial of sorts

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 23 Oct 1998 18:42:35 -0700, Hawke <mdeland at NWINFO.NET> wrote:

>Irv Mullins wrote:
>> So we have assignment 1.1
>> Write a *validate* function, to take input, return a number
>> within a specified range, or print an error message and
>> abort.
>
><me put hand up, meekishly>
>
>ummm....
>abort().  bad... bad bad.
><me watch user lose data>
>
>allow user to re-enter improper data. good.
><me watch user retain data>
>
></me put hand up>
>
>assignment 1.1A perhaps?
>Write a validate function, to take an input from the
>user or the command line, and return a number within
>a specified range, or print an error message and
>allow the user the ability to retype the improper input,
>without having to have the user retype *all* of the
>other inputs (such as only one parameter on the command
>line being improper... just fix that one parameter)

OK, if you can do it in 10 lines or less. We're trying to
keep this at the beginning programmer level.

Besides, it's good for the programmer to learn that data
*CAN* get lost, and why.
It makes for more careful programmers.
Suppose you are printing paychecks for 3,000 people.
Do you stop and ask for each incorrect entry, or is there
a better way?

Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu