Avatar ·

How to return multiple values from a function in Kotlin (Swift analog)

Hello! I'm switching from Swift to Kotlin and encountered an unexpected problem. In Swift, I'm used to returning multiple values from a function using tuples. For example: ```swift func getUser() -> (name: String, age: Int) { return ("Alice", 30) } let user = getUser() print(user.name, user.age) ``` This is very convenient: I can return related data without creating a separate class or structure. But in Kotlin, I can't find a similar syntax. I tried to write something like: ```kotlin fun getUser(): (String, Int) { // Compilation error return ("Alice", 30) } ``` But the compiler complains. I understand that Kotlin has Pair and Triple, but they look cumbersome, especially if there are more than three fields. Plus, I have to access elements via .first, .second, which makes