User Input
Learn how Kotlin console applications can receive input from users.
Kotlin Code
Study the example and understand each part.
fun main() {
print("Enter your name: ")
val name = readLine()
println("Welcome, $name")
}
Kotlin is commonly developed using Android Studio or IntelliJ IDEA. These examples can be used as a foundation for Android application development.
Key Concept
Console input can be received using readLine(). Android apps normally receive input through UI controls such as text fields.
Expected Output / Result
Run this example in a Kotlin development environment to see the result.
Finished this lesson?
Mark it complete to update your course progress.