I am typing a typical game in console now. But I have a mistake about loops. How can I use continue keyword in for loop in while loop? I want to use it for while loop.
*****while (true) {
System.out.print("Please type a number(It must be in between 0-"+width2+") to define the row : ");
int x = input.nextInt();
while (x<1 || x>width) {
System.out.print("Please type a avaliable number to define the row : ");
x = input.nextInt();
}
System.out.print("Please type a number(It must be in between 0-"+length2+") to define the column : ");
int y = input.nextInt();
while (y<1 || y>length) {
System.out.print("Please type a avaliable number to define the column : ");
y = input.nextInt();
}
System.out.println();
int value = 10*x + y;
for (int i = 0; i < x * y; i++) {
if (value == array[i]) {
System.out.println("Please type different values from beforehands.");
continue;
}
}
array[counter] = value;
System.out.println("array["+counter+"] = "+array[counter]);
counter++;
if (gamingArea[x-1][y-1] == 0) {
point+=10;
continue;
}else {
System.out.println("GAME OVER! Your point is "+point+".");
break;
}
}*****