Posted: Tue Nov 01, 2011 11:30 pm Post subject: Re: How do i get my program to quit when the number is less or more ~!!~~!! :(
Man, that blows, I don't what I would've done if my teacher had done that.
I feel bad that you're being held back like this.
Maybe you can make a simple version for class, and a good one for yourself if you have the time.
Sponsor Sponsor
tg851
Posted: Wed Nov 02, 2011 10:00 am Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
same issue here with the teacher,except its not him holding us back,its the administrative they send in to check were doing"board acceptable work",also look into error.halt to make it quit with a message
Velocity
Posted: Thu Nov 10, 2011 10:49 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
I had a project like this in grade 10, but it was more advanced but same topic. I got 100% << as always... if you want, you can pm me. I can send you mine and explain to you the terms and all that i used.
Velocity
Posted: Thu Nov 10, 2011 10:53 pm Post subject: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
to answer your question.
You can make an if statement and write :
if yrs >= 9 and yrs >= 16 then
quit
(or exit)
end if
or you can type
yrs1 := yrs >= 9 and yrs >= 16
if yrs1 then
exit
else
put ".... lalala ( or you dont have to do this and you can just end if)"
end if
Beastinonyou
Posted: Fri Nov 11, 2011 7:50 am Post subject: Re: RE:How do i get my program to quit when the number is less or more ~!!~~!! :(
Velocity @ Thu Nov 10, 2011 10:53 pm wrote:
if yrs >= 9 and yrs >= 16 then
quit
(or exit)
end if
or you can type
yrs1 := yrs >= 9 and yrs >= 16
if yrs1 then
exit
else
put ".... lalala ( or you dont have to do this and you can just end if)"
end if
That is not even correct syntax, with making a variable to what an if statement could be. And when you put "if yrs1 then", that would work for a boolean. Not what you just did.
Plus, if yrs is >= 9 and >= 16, that's all numbers from 9 and up, beyond 16.
Quite simply, all you need is this:
Turing:
if years < 10or years > 16then put"Incorrect number of years. Must be between 10 and 16" delay(2000) exit endif
or if you want the window to close, you'd need:
Turing:
var window :int:=Window.Open("graphics: 500; 500")% At the beginning of the program. Opens 500 by 500 window Window.Close(window)% Can be used instead of exit, to fully close the window.