2019年5月20日 星期一

Kotlin學習筆記(9) Declares a variable without initialization.

Kotlin學習筆記(9) Declares a variable without initialization.

fun main() {
      val d: Int  // 1

      if (someCondition()) {
          d = 1   // 2
      } else {
          d = 2   // 2
      }

      println(d) // 3

}

輸出畫面
1
  1. Declares a variable without initialization.
  2. Initializes the variable with different values depending on some condition.
  3. Reading the variable is possible because it's already been initialized.

沒有留言:

張貼留言

結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統

視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 這份 gui_app_timer.py 程式是一個 結合桌面視窗介面 (GUI)、雲端資料庫與社群通訊推播的自動化氣象監控系統 。 整體架構採用 事件驅動 (Event-Driven) 與 多執行緒非同步設計...