<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國際加速解決方案。 廣告
                # Kotlin 程序:使用循環顯示從 A 到 Z 的字符 > 原文: [https://www.programiz.com/kotlin-programming/examples/display-alphabets](https://www.programiz.com/kotlin-programming/examples/display-alphabets) #### 在此程序中,您將學習在 Kotlin 中使用`while`循環打印英文字母。 您還將學習學會僅打印大寫和小寫字母。 ## 示例 1:顯示大寫的 A 到 Z ```kt fun main(args: Array<String>) { var c: Char c = 'A' while (c <= 'Z') { print("$c ") ++c } } ``` 運行該程序時,輸出為: ```kt A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ``` 與 Java 一樣,您可以使用`for`循環從 A 到 Z 循環,因為它們以 ASCII 字符存儲在 Kotlin 中。 因此,在內部,您可以在 65 到 90 之間循環打印英文字母。 以下是等效的 Java 代碼:[用于顯示英文字母的 Java 程序](/java-programming/examples/display-alphabets "Java Program to Display Characters from A to Z using loop") 稍加修改即可顯示小寫字母,如下例所示。 * * * ## 示例 2:顯示小寫的 a 到 z ```kt fun main(args: Array<String>) { var c: Char c = 'a' while (c <= 'z') { print("$c ") ++c } } ``` 運行該程序時,輸出為: ```kt a b c d e f g h i j k l m n o p q r s t u v w x y z ``` 您只需將`"A"`替換為`"a"`,將`"Z"`替換為`"z"`以顯示小寫字母。 在這種情況下,您會在內部循環通過 97 到 122。
                  <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>

                              哎呀哎呀视频在线观看