Skip to content

Kotlin Basics : Strings

Devrath edited this page Dec 24, 2023 · 1 revision
// Assigning explicitly the data type and then setting a value to it
// This will always accept only the integer
var age : Int = 21
var firstName : String = "Tony"
// Kotlin can infer the values so that we need not have to explicitly mention them, Meaning datatype , we need not have to add
var lastName : String = "Stark"
println("My name is $firstName $lastName and I am $age years old scientist")
// Appending the variables in the string is reformatting it is called string interpolation
Clone this wiki locally