Ask coding questions

← Back to all posts
How to go back

So If you take a look at my code in down I said Thank you for registering a bus. I mean I don't want to user stop the code and run it again. I just want a code that takes user back to the main menu. Every time when he click 1 or 2 just a button doesn't matter. Can you guys help me.

Thank you


Use a loop.


@Highwayman Hey highwayman. I put your while. Code you send me and if you check my code again. My Code goes. But it goes forever. I don't if you are able to do changes, to my code. If you are able. Can you do it for me. And send me a picture or the code. If it is possible. Thank you.


@softwarenginner here how about this. First I’m going to tell you how a while loop works, and then I am going to send you an online tutorial which I think you should take, because the answers to a lot of your problems seem like they could be answered by it.

While loops:
A loop is self explanatory I think, when you surround a block of code with a loop, it is repeated. A while loop is a type of loop that takes a single condition and checks that condition every time it repeats the given block of code. Here’s an example:

Here’s the tutorial:


Thank you I find the answer.