I am programming a simulated online banking client in java. I need the ability (or an alternative) to be able to continue from a label. This is a snippet from my code so far.
Main:
{
for ( ; ;) {
System.out.println("Welcome to Tamarin© online banking!");
System.out.println("Select register or login:");
choice = scan.nextLine();
if (choice.equalsIgnoreCase("register")) {
register:
{
System.out.println("Welcome to register! Please type your username:");
userreg = scan.nextLine();
if (accounts.contains(userreg)) {
System.out.println("Username taken! Try again.");
continue register;
Java is giving me a "continue cannot be used outside of loop" error. Any ideas as to (if the registration fails) I could bring the user back to the last step ('registration' label)? And if not, how could I get this code to work?
(I obviously have closing braces down at the end).