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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Kotlin 注釋 > 原文: [https://www.programiz.com/kotlin-programming/comments](https://www.programiz.com/kotlin-programming/comments) #### 在本文中,您將了解 Kotlin 注釋,以及為什么以及如何使用它們。 在編程中,注釋是程序的一部分,旨在供您和您的其他程序員理解代碼。 Kotlin 編譯器(Kompiler)完全忽略了它們。 與 Java 類似,在 Kotlin 中有兩種類型的注釋 * `/* ... */` * `// ....` * * * ## 傳統注釋`/* ... */` 這是一條多行注釋,可以跨越多行。 Kotlin 編譯器會忽略從`/*`到`*/`的所有內容。 例如, ```kt /* This is a multi-line comment. * The problem prints "Hello, World!" to the standard output. */ fun main(args: Array<String>) { println("Hello, World!") } ``` 傳統注釋也用于記錄 Kotlin 代碼(KDoc)并稍有變化。 KDoc 注釋以`/**`開頭并以`*/`結束。 * * * ## 行尾注釋`//` 編譯器忽略從`//`到行尾的所有內容。 例如, ```kt // Kotlin Hello World Program fun main(args: Array<String>) { println("Hello, World!") // outputs Hello, World! on the screen } ``` 上面的程序包含兩個行尾注釋: ```kt // Kotlin Hello World Program ``` 和 ```kt // outputs Hello, World! on the screen ``` * * * ## 以正確的方式使用注釋 <section> 注釋不能代替解釋英文書寫不好的代碼的方法。 編寫結構良好且易讀的代碼,然后使用注釋。 一些人認為代碼應該是自我記錄的,注釋應該很少。 但是,我必須完全不同意(這是我個人的觀點)。 使用注釋來解釋復雜的算法,[正則表達式](http://www.rexegg.com/)或在其中您選擇一種技術而非其他技術(以供將來參考)的場景中并沒有什么問題。 在大多數情況下,請使用注釋來解釋“為什么”而不是“怎么做”,這樣您就很好了。 </section>
                  <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>

                              哎呀哎呀视频在线观看