Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Hello. need to end program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
darkshade




PostPosted: Thu Sep 13, 2007 11:21 am   Post subject: Hello. need to end program

hello. in my program i need to know how to get it to finish in a if statment.

here is my code so far. i have commeted on the area i need it to end in. please help.

Turing:

var math1,math2,math3:string
var input1,input2,input3:int
math1:="5+5"
math2:="10+10"
math3:="20+20"
input1:=0
input2:=0
input3:=0
proc quiz1
put "What is ",math1
get input1
end quiz1

proc quiz2
put "What is ",math2
get input2
input1:=0
end quiz2

proc quiz3
put "What is ",math3
get input3
input2:=0
end quiz3

proc done
put "Congrats"
end done

proc input
if (input1=10) then
quiz2
elsif (input2=20) then
quiz3
elsif (input3=40) then
done
else
put "FAIL"
%i need it to finish at this point. i do not know the command.
end if
end input

proc main
quiz1
input
input
input
end main
main
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Thu Sep 13, 2007 11:51 am   Post subject: RE:Hello. need to end program

Try adding quit.
darkshade




PostPosted: Thu Sep 13, 2007 12:02 pm   Post subject: Re: Hello. need to end program

Thank you sooooo much. i have tryed everything else! finish, break,end, exit! thank you! it works now!
Carey




PostPosted: Mon Sep 24, 2007 12:19 pm   Post subject: Re: Hello. need to end program

You can also use return. return is better because when you compile it into an *.exe with the option "Immediately close run window" it only exits and doesn't say "Error: Quit#1" and die. however when return is used in a procedure, function, etc, it only exits that proc. In order for it to finish a program it has to be on the main level (not in a proc or other).
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: