我是java初学者,我正在进行for循环和while循环.我理解它们是如何工作的,但我无法弄清楚如何从for循环转换为while循环.
for(int row=rowIndex+1; row<this.getMaxRows(); row++){
if(board[row][colIndex]==board[rowIndex][colIndex] && row!=rowIndex)
{
this.setBoardCell(row, colIndex, BoardCell.EMPTY);
score++;
}
else{
break;
}
}
Run Code Online (Sandbox Code Playgroud)