Subject: Re: FINAL PROJECT!
To: averducc@ucsd.edu
Date: Wed, 10 Mar 1999 04:25:52 -0800 (PST)
Cc: ir118@sdcc3.ucsd.edu (Carl Gibson)
Reply-To: ir118@sdcc3.ucsd.edu
X-Status:
Dear Andrea:
Thanks for the email. I tried your loop, and it does just
what it says. You can't get out unless months is 24 or 36, but if
months is one of these it can't be the other, so the program prints
the statement in the first block of your if statement...always the
same message. I think you want "and" instead of "or" in your if
statement. This leaves you in the loop until the user provides either
24 or 36 as the answer, and then prints out which was entered.
Cheers,
CHG
> Hi!
> I was wondering if you could answer a question for me about my final
> project. I hope you get this soon, too so I can turn it in early!
>
> I cannot figure out why one of my DO/LOOPS is not working. This is what
> it looks like:
>
> DO until months = 24 or months = 36
> INPUT prompt "24 or 36 months? ": months
> IF months <> 24 or months <> 36 then
> PRINT "Invalid. Please try again:"
> ELSE
> PRINT "You have entered"; months; "months."
> END IF
> LOOP
>
> What happens is that even when 24 or 36 is entered it says: "Invalid.
> Please try again:" and then skips to the next part of the program. I am
> not sure why it is doing this. If you have any ideas for me they would
> be much appreciated. Thank you so much for your time!
> Andrea Verducci