<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # break和continue ## 1\. break ### 1.1 for循環 * 普通的循環示例如下: ~~~ name = 'itheima' for x in name: print('----') print(x) else: print("==for循環過程中,如果沒有執行break退出,則執行本語句==") ~~~ 運行結果: ~~~ ---- i ---- t ---- h ---- e ---- i ---- m ---- a ==for循環過程中,如果沒有break則執行== ~~~ * 帶有break的循環示例如下: ~~~ name = 'itheima' for x in name: print('----') if x == 'e': break print(x) else: print("==for循環過程中,如果沒有執行break退出,則執行本語句==") ~~~ 運行結果: ~~~ ---- i ---- t ---- h ---- ~~~ ### 1.2 while循環 * 普通的循環示例如下: ~~~ i = 0 while i<5: i = i+1 print('----') print(i) else: print("==while循環過程中,如果沒有執行break退出,則執行本語句==") ~~~ 運行結果: ~~~ ---- 1 ---- 2 ---- 3 ---- 4 ---- 5 ==while循環過程中,如果沒有break則執行== ~~~ * 帶有break的循環示例如下: ~~~ i = 0 while i<5: i = i+1 print('----') if i==3: break print(i) else: print("==while循環過程中,如果沒有執行break退出,則執行本語句==") ~~~ 運行結果: ~~~ ---- 1 ---- 2 ---- ~~~ ### **小結:** * break的作用:立刻結束break所在的循環 ## 2\. continue ### 2.1. for循環 * 帶有continue的循環示例如下: ~~~ name = 'itheima' for x in name: print('----') if x == 'e': continue print(x) else: print("==while循環過程中,如果沒有break則執行==") ~~~ 運行結果: ~~~ ---- i ---- t ---- h ---- ---- i ---- m ---- a ==while循環過程中,如果沒有break則執行== ~~~ ### 2.2 while循環 * 帶有continue的循環示例如下: ~~~ i = 0 while i<5: i = i+1 print('----') if i==3: continue print(i) ~~~ 運行結果: ~~~ ---- 1 ---- 2 ---- ---- 4 ---- 5 ~~~ ### **小結:** * continue的作用:用來結束本次循環,緊接著執行下一次的循環 ## 3\. 注意點 * break/continue只能用在循環中,除此以外不能單獨使用 * break/continue在嵌套循環中,只對最近的一層循環起作用
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看