0
how do I return to main in Kotlin?
I want to repeat the main function continuously
3 Answers
+ 1
Technically you could invoke main from main, but thatâs really bad form. Normally if you want to loop, youâll use use a WHILE TRUE, then build in an EXIT whereever you want the code to exit. What you really want is to learn how to do while and for loops. You donât want to invoke main from main.
+ 8
Hello there! :)
If you try to repeat the main function you'll probably get an error.
I suggest you to create your own main function and to repeat it as your necessity.
- you only need to call it more in the main;
- you can costumize it;
- it's easy to use.
I made a little example :)
https://code.sololearn.com/cKDGZbT1g407/?ref=app
0
Jerry Hobby Exactly what I needed to know, thanks alot