Kotlin 與 Swift 語法對照:跨平台開發者 (2025年)

Kotlin 與 Swift 語法對照表(2025 年版) 在行動應用開發中, Kotlin 與 Swift 分別是 Android 與 iOS 的主流語言。雖然語法有些差異,但其實它們有很多相似之處。本文整理了常用的語法對照表,方便跨平台開發者快速上手。 1. 變數宣告 // Kotlin val name: String = "Alice" // 常數 var age: Int = 25 // 可變數 // Swift let name: String = "Alice" // 常數 var age: Int = 25 // 可變數 2. 條件判斷 // Kotlin if (age >= 18) { println("Adult") } else { println("Minor") } // Swift if age >= 18 { print("Adult") } else { print("Minor") } 3. 函式定義 // Kotlin fun greet(name: String): String { return "Hello, $name!" } // Swift func greet(_ name: String) -> String { return "Hello, \(name)!" } 4. 陣列與迴圈 // Kotlin val fruits = listOf("Apple", "Banana", "Cherry") for (fruit in fruits) { println(fruit) } // Swift let fruits = ["Apple", "Banana", "Cherry"] for fruit in fruits { print(f...

UVa 解題總覽 (with Java)

解題總覽

  1. [題目] UVa 105 The Skyline Problem
  2. [題目] UVa 118 Mutant Flatworld Explorers
  3. [題目] UVa 136 Ugly Numbers
  4. [題目] UVa 145 Gondwanaland Telecom
  5. [題目] UVa 272 TEX Quotes
  6. [題目] UVa 488 Triangle Wave
  7. [題目] UVa 490 Rotating Sentences
  8. [題目] UVa 501 Black Box
  9. [題目] UVa 948 Fibonaccimal Base
  10. [題目] UVa 1062 Containers
  11. [題目] UVa 1730 Sum of MSLCM
  12. [題目] UVa 10008 What’s Cryptanalysis?
  13. [題目] UVa 10009 All Roads Lead Where?
  14. [題目] UVa 10013 Super long sums
  15. [題目] UVa 10018 Reverse and Add
  16. [題目] UVa 10019 Funny Encryption Method
  17. [題目] UVa 10025 The ? 1 ? 2 ? … ? n = k problem
  18. [題目] UVa 10035 Primary Arithmetic
  19. [題目] UVa 10038 Jolly Jumpers
  20. [題目] UVa 10041 Vito’s family
  21. [題目] UVa 10055 Hashmat the brave warrior
  22. [題目] UVa 10057 A mid-summer night’s dream.
  23. [題目] UVa 10062 Tell me the frequencies!
  24. [題目] UVa 10071 Back to High School Physics
  25. [題目] UVa 10098 Generating Fast, Sorted Permutation
  26. [題目] UVa 10100 Longest Match
  27. [題目] UVa 10101 Bangla Numbers
  28. [題目] UVa 10107 What is the Median?
  29. [題目] UVa 10114 Loansome Car Buyer
  30. [題目] UVa 10115 Automatic Editing
  31. [題目] UVa 10130 SuperSale
  32. [題目] UVa 10189 Minesweeper
  33. [題目] UVa 10193 All You Need Is Love
  34. [題目] UVa 10215 The Largest/Smallest Box …
  35. [題目] UVa 10235 Simply Emirp
  36. [題目] UVa 10252 Common Permutation
  37. [題目] UVa 10282 Babelfish
  38. [題目] UVa 10340 All in All
  39. [題目] UVa 10346 Peter’s Smokes
  40. [題目] UVa 10424 Love Calculator
  41. [題目] UVa 10489 Boxes of Chocolates
  42. [題目] UVa 10550 Combination Lock
  43. [題目] UVa 10591 Happy Number
  44. [題目] UVa 10611 The Playboy Chimp
  45. [題目] UVa 10626 Buying Coke
  46. [題目] UVa 10633 Rare Easy Problem
  47. [題目] UVa 10703 Free spots
  48. [題目] UVa 10730 Antiarithmetic?
  49. [題目] UVa 10791 Minimum Sum LCM
  50. [題目] UVa 10815 Andy’s First Dictionary
  51. [題目] UVa 10926 How Many Dependencies?
  52. [題目] UVa 10931 Parity
  53. [題目] UVa 10954 Add All
  54. [題目] UVa 10978 Let’s Play Magic!
  55. [題目] UVa 11044 Searching for Nessy
  56. [題目] UVa 11063 B2-Sequence
  57. [題目] UVa 11089 Fi-binary Number
  58. [題目] UVa 11115 Uncle Jack
  59. [題目] UVa 11150 Cola
  60. [題目] UVa 11233 Deli Deli
  61. [題目] UVa 11332 Summing Digits
  62. [題目] UVa 11364 Optimal Parking
  63. [題目] UVa 11388 GCD LCM
  64. [題目] UVa 11417 GCD
  65. [題目] UVa 11455 Behold My Quadrangle
  66. [題目] UVa 11461 Square Numbers
  67. [題目] UVa 11541 Decoding
  68. [題目] UVa 11586 Train Tracks
  69. [題目] UVa 11634 Generate random numbers
  70. [題目] UVa 11636 Hello World!
  71. [題目] UVa 11716 Digital Fortress
  72. [題目] UVa 11727 Cost Cutting
  73. [題目] UVa 11734 Big Number of Teams will Solve This
  74. [題目] UVa 11743 Credit Check
  75. [題目] UVa 11764 Jumping Mario
  76. [題目] UVa 11827 Maximum GCD
  77. [題目] UVa 11917 Do Your Own Homework!
  78. [題目] UVa 12289 One-Two-Three
  79. [題目] UVa 12405 Scarecrow
  80. [題目] UVa 12439 February 29

留言

這個網誌中的熱門文章

【Ubuntu】Terminal 複製貼上的方法 Copy & Paste

【Ubuntu】關閉預設畫面自動鎖定

[Java] HashMap資料結構簡介與用法