Re: [問題] 請問break跳出的範圍已回收
※ 引述《supermicro (加油加油~~~~)》之銘言:
: 一個有很多for的回圈的內部
: for #1
: ...
: for #2
: ...
: if #3
: break
: end
: end
: for #4
: ...
: end
: end
: 像這樣的話,在 #3 的迴圈中的 break 到底會break到幾個迴圈? 好像會break兩個耶,
: 是一次兩個這樣嗎? 好像有點怪怪的說... 請大家幫我指正,謝謝~
這...不是help一下就知道了嗎?
>> help break
BREAK Terminate execution of WHILE or FOR loop.
BREAK terminates the execution of FOR and WHILE loops.
In nested loops, BREAK exits from the innermost loop only.
BREAK is not defined outside of a FOR or WHILE loop.
Use RETURN in this context instead.
See also for, while, return, continue.
Reference page in Help browser
doc break
所以只跳一個迴圈
就這樣
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.54.153
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章