Ask coding questions

← Back to all posts
Loop Problem!!
TheRealGMG (0)

For some reason after the spin machine at the end of my code is run and you say you want to login as a new user, the code doesn't loop back to "programState 0". I've made the program console out the programState but it just won't loop back. Any suggestions?

The login username is: administrator
And the password is: admin123

malvoliothegood (709)

There is a lot going on within main. This makes it hard to debug. Ideally you should have only one loop in main and the logiv should be contained in functions that are called at some logical point. Each function should return a success or failure value (they may return other things as well). This can be tested to see if there has been an error and appropriate action can be taken.

TheRealGMG (0)

@malvoliothegood Alright, thanks. I'll give it a shot!