<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Perl 中的`if`語句 > 原文: [https://beginnersbook.com/2017/02/if-statement-in-perl/](https://beginnersbook.com/2017/02/if-statement-in-perl/) `if`語句包含條件,后跟一個語句或一組語句,如下所示: ```perl if(condition){ Statement(s); } ``` 只有在給定條件為真時才會執行語句。如果條件為`false`,那么`if`語句體內的語句將被完全忽略。 #### 例: 在以下示例中,我們將一個整數值賦給變量`num`。使用`if`語句,我們檢查分配給`num`的值是否小于 100。 ```perl #!/usr/local/bin/perl printf "Enter any number:"; $num = <STDIN>; if( $num < 100 ){ # This print statement would execute, # if the above condition is true printf "num is less than 100\n"; } ``` **輸出:** ```perl Enter any number:78 num is less than 100 ``` ## perl 中的嵌套`if`語句 當在另一個`if`語句中有`if`語句時,它將被稱為嵌套`if`語句。 嵌套的結構如下所示: ```perl if(condition_1) { Statement1(s); if(condition_2) { Statement2(s); } } ``` 如果`condition_1`為`true`,則執行`Statement1`。只有條件(`condition_1`和`condition_2`)都為真時,`Statement2`才會執行。 #### 示例: ```perl #!/usr/local/bin/perl printf "Enter any number: "; $num = <STDIN>; if( $num < 100 ){ printf "num is less than 100\n"; if( $num > 90 ){ printf "num is greater than 90\n"; } } ``` **輸出:** ```perl Enter any number: 99 num is less than 100 num is greater than 90 ```
                  <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>

                              哎呀哎呀视频在线观看