in reply to Looped around my neck (help with my poor little loops!)
pojset $max_tries to 3. ask user for $range of guess generate $answer as a random number from 1..$range FOR $loop from 1 to $max_tries $guess_count = $loop get $user_guess if $user_guess is the $answer then exit loop ENDFOR IF $user_guess equals the $answer message : Well done, you got it in $guess_count ELSE message : Sorry, you've had $max_tries guesses ENDIF
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Looped around my neck (help with my poor little loops!)
by sulfericacid (Deacon) on Mar 15, 2003 at 23:49 UTC | |
by poj (Abbot) on Mar 15, 2003 at 23:54 UTC | |
by sulfericacid (Deacon) on Mar 16, 2003 at 00:00 UTC | |
by poj (Abbot) on Mar 16, 2003 at 00:13 UTC | |
by pfaut (Priest) on Mar 16, 2003 at 00:07 UTC |