var is used for variable in Kotlin also
var variables = " I am a variable"
variables = "I can be re-assigned"
let used in Swift val is used for constant in Kotlin
let constant = " I am a constant"
//constant = " I cannot be re-assigned" //Error
var text = "hello" // Inferred as String
var number = 45.0 // Inferred as Double
var numberFloat:Float = 45.0 // Inferred as Float
// String interpolation to construct texts
print ("Value of variables is \(variables)")
let multilineString = """
Hello I am a
multiline string
"""
print(multilineString)
Groups Multiple Values into a single compound values.Tuples can hold different data types also
let error = ( 500, "Internal Server Error") // tuple of type (Int, String)
// Decompose a tuple
// In Kotlin, we can use Pairs or Triples for this
let (code, errorMessage) = error
print(code)
print(errorMessage)
// Used in a situation where value can be absent