Strings and String Templates
Work with text and learn how Kotlin string templates make it easy to combine variables with strings.
Kotlin Code
Study the example and understand each part.
fun main() {
val name = "Vinsoft Lab"
val students = 100
println("Welcome to $name")
println("There are $students students.")
println("Next year there may be ${students + 50} students.")
}
Kotlin is commonly developed using Android Studio or IntelliJ IDEA. These examples can be used as a foundation for Android application development.
Key Concept
String templates allow variables and expressions to be inserted directly inside Kotlin strings.
Expected Output / Result
Welcome to Vinsoft Lab There are 100 students. Next year there may be 150 students.
Finished this lesson?
Mark it complete to update your course progress.