Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Triple samples
// triple
var kotlinVersions = Triple(1.1, 1.2, 1.3)
var firstKotlinVersion = kotlinVersions.first
var secondKotlinVersion = kotlinVersions.second
var thirdKotlinVersion = kotlinVersions.third
// combine different data types
var kotlinBook = Triple(1289, "Learn Kotlin from GDE", 21.99)
val (isbn, title, price) = kotlinBook
println("ISBN = ${kotlinBook.first} , Title = ${kotlinBook.second} , Price = ${kotlinBook.third}")
val addressBook = Triple("Kotlin", 789456123, "Saint Petersburg")
val (name, phone, address) = addressBook
println("Name = ${addressBook.first} , Phone = ${addressBook.second} , Address = ${addressBook.third}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment