for (;;) {
System.out.println("---> Your choice: ");
choice = input.nextInt();
if (choice==1)
playGame();
if (choice==2)
loadGame();
if (choice==3)
options();
if (choice==4)
credits();
if (choice==5)
System.out.println("End of Game\n Thank you for playing with us!");
break;
else
System.out.println("Not a valid choice!\n Please try again...\n");
}
Также, если у вас есть идеи получше, как представить этот код, не стесняйтесь
Я продолжаю получать сообщение об ошибке, если без else. Я тоже пробовал, если [code]for (;;) { System.out.println("---> Your choice: "); choice = input.nextInt(); if (choice==1) playGame(); if (choice==2) loadGame(); if (choice==3) options(); if (choice==4) credits(); if (choice==5) System.out.println("End of Game\n Thank you for playing with us!"); break; else System.out.println("Not a valid choice!\n Please try again...\n"); } [/code] Также, если у вас есть идеи получше, как представить этот код, не стесняйтесь :)