我有以下的功能,但儘管使用了break語句,它似乎並沒有被停止找到的陣列中的比賽後:不能突破的嵌套for循環
private function CheckMatch() {
// _playersList is the Array that is being looped through to find a match
var i:int;
var j:int;
for (i= 0; i < _playersList.length; i++) {
for (j= i+1; j < _playersList.length; j++) {
if (_playersList[i] === _playersList[j]) {
trace("match:" + _playersList[i] + " at " + i + " is a match with "+_playersList[j] + " at " + j);
break;
} else {
// no match
trace("continuing...")
}
}
}
}
你的意思是什麼它輸出匹配嗎?你用調試器檢查過嗎? – 2010-01-12 16:58:28
我的意思是,根據跟蹤報表,我仍然在前面的跟蹤顯示匹配之後看到「繼續」。 – redconservatory 2010-01-12 17:04:52