Triple Type in Kotlin

Level 2100 keystrokes

Creates a Triple and reads its three components.

Kotlin code

// Triple holds exactly three values, here a String, an Int and a Boolean
1val triple = Triple("A", 1, true)
// first is the first value: A
2println(triple.first)
// second is the second value: 1
3println(triple.second)
// third is the third value: true
4println(triple.third)

Output

A
1
true
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Kotlin code and how often they appear.

  • (× 4
  • )× 4
  • .× 3
  • ,× 2
  • "× 2
  • =× 1

More Kotlin examples at level 2

← Kotlin typing practice