Kotlin: introduction to data classes

Example:

data class User(val name: String, val age: Int)
Data classes in Kotlin are concise and provide several built-in functions.

Solution:

val john = User("John", 25) print(john.name)

Beginner's Guide to Kotlin