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

Username:   Password: 
 RegisterRegister   
 How to exit in a case?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BlackCoyote




PostPosted: Thu Jan 24, 2019 5:55 pm   Post subject: How to exit in a case?

Alright, so I am working on a project for school. It requires a menu in order to select what you would like, the third option has to be exit, but I can't seem to figure out what needs to go here to exit the case, and in turn, exit the program, as the user said exit. How would I go about doing something like this? Also, when I input my choices using a string, it says that the case alternative label is the wrong type

Thanks in advance for helping in anyway you can. Smile

~BlackCoyote

Turing version 4.1.1


Sample Code:
var Choice: string(1)
put "":33, "Stoplight Menu"
put ""
put ""
put ""
put "Please select one of the following choices"
put ""
put "":33, "1 - Intersection"
put ""
put "":33, "2 - Light Show"
put ""
put "":33, "3 - Exit"
put ""
getch (Choice)

case Choice of
label 1 :
Int_Sub
label 2 :
Light_Show
label 3 :
exit
label :
put "Invalid, please reselect"
end case
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Jan 25, 2019 2:30 am   Post subject: RE:How to exit in a case?

You have two options. You can use the quit keyword, which will terminate the program immediately, or you can have that case do nothing, and simply let the program run out of code.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: