How to return 3 separate data values of the same type (Int
) from a function in Kotlin?
I'm attempting to return the time of day, I need to return the Hour, Minute and Second as separate integers, but all in one go from the same function, is this possible?
In swift we do it like following,
func getTime() -> (Int, Int, Int) {
...
return ( hour, minute, second)
}
can we achieve this in Kotlin?
P.S: I know I can use Array or Hashmap for this but I want to know if there exists something in Kotlin like it is in Swift.