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

Username:   Password: 
 RegisterRegister   
 How to return?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Vorpike




PostPosted: Fri Dec 21, 2012 7:02 pm   Post subject: How to return?

So I'm trying to make a game menu, from there, you can click a button for instructions, but I need a button to bring me back to the main menu. I tried making a procedure for the menu, and when the the back button is pressed, I run the menu, but this procedure-ception clearly doesn't work. A friend also told me to use a return syntax, which brings me out of the if and back to the menu. But return is basically exit and that didn't work either. So somebody please tell me, how do I make a suitable back button? Sorry, I deleted my code as soon as I saw it didn't work.

Code is attached



Monopoly.7z
 Description:

Download
 Filename:  Monopoly.7z
 Filesize:  95.96 KB
 Downloaded:  70 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Dec 22, 2012 10:46 pm   Post subject: RE:How to return?

A procedure ends when it reaches the end of the code in the procedure. If you're running a loop, just quit the loop and skip to the end. If necessary, use if statements to skip past extra code.

Also, 'return' is a perfectly valid way to quit the procedure. It is not the same as 'exit'. 'exit' is used to quit loops where 'return' quits procedures.
simpletrick




PostPosted: Mon Dec 31, 2012 4:42 pm   Post subject: Re: How to return?

I would use procedures that will "loop" back to main menu.
Procedure game/option/help/whatever, and procedure menu.
and "loop" it back to menu
Insectoid




PostPosted: Mon Dec 31, 2012 6:06 pm   Post subject: RE:How to return?

That makes no sense.
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: