Re: [問題] 請問break跳出的範圍已回收

看板MATLAB作者 (Veritas)時間17年前 (2008/12/10 08:08), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《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
文章代碼(AID): #19FmXmnq (MATLAB)
文章代碼(AID): #19FmXmnq (MATLAB)