Since Kotlin is a statically typed language, the compiler always knows what data type a variable stores. You can write the type yourself, or let Kotlin figure it out automatically from the value. This feature is called type inference.
kotlin
fun main() {
val age: Int = 25
val price: Double = 19.99
val grade: Char = 'A'
val isActive: Boolean = true
val title: String = "Kotlin Basics"
println("$title - age limit: $age")
println("Price: $price")
println("Grade: $grade")
println("Active: $isActive")
}You should see
Kotlin Basics - age limit: 25 Price: 19.99 Grade: A Active: trueSummary
Understanding data types means storing values in the right shape, which cuts down on errors.