Kotlin 的工具函式 forEach() 也是使用疊代器,可以將前例改寫如下: fun main() { // 熟練後的寫法 listOf(1, 2, 3, 4, 5).forEach { print(it) } ...
確定! 回上一頁