https://kotlinlang.org logo
#random
Title
# random
e

Edoardo Luppi

02/25/2024, 3:35 PM
Is there a proposal to adopt Go's style for returning multiple values?
Copy code
fun example(): (String, String) {
  return "one", "two"
}
That could be converted by the compiler to a
Pair<String, String>
, for example.
y

Youssef Shoaib [MOD]

02/25/2024, 3:41 PM
Is the
return
statement that much nicer than
return "one" to "two"
?
2
e

Edoardo Luppi

02/25/2024, 3:42 PM
Well, with a pair it's not evident, but it gets better with more values. The return type is also easier to read imo.
e

Edoardo Luppi

02/25/2024, 3:46 PM
Cool! Thank you