Daily Archive: 2017-06-12

Kotlin Reference: Destructuring Declarations

  有时候需要把一个对象解构(Destructure)为一系列变量,如: [code lang=”kotlin”]val (name, age) = person[/code] 上面的语法称为解构声明(Destructuring Declaration),解构声明可以一次性创建多个变量。我们声明了两个变量:name 和 age,可以单独地使用它们: [code lang=&…
Read more