Cloud Stack Ninja

I am trying to use goto statement to restart a player's turn but its not working.

if(spaceCheck(arr))
            {
            crack:
                System.out.println("Player "+player+"'s Turn:");
                System.out.print("Row : ");
                row=s.nextInt();
                System.out.print("Column : ");
                column=s.nextInt();

                if(indexValidate(arr,row,column))
                    {
                        arr[row][column]=player;
                    }
                else
                    {
                        goto crack;
                    }


Read more here: https://stackoverflow.com/questions/64416670/illegal-start-of-expression-in-using-goto-statement-in-java

Content Attribution

This content was originally published by Hassam Ullah at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: