Answers for "how to return multiple values from a function in kotlin"

0

return two values kotlin

fun main() {
    val userFeedback = UserFeedback("Siv", "[email protected]", "Can you check this")
    
    val (name, emailId) = userFeedback
    System.out.println("emailId :" + emailId)
    System.out.println("name :" + name)
                       
}

data class UserFeedback constructor(val name: String, val emailId: String, val comments: String)
Posted by: Guest on October-23-2021
0

return two values kotlin

fun main() {
    val (name, _, comments) = getFeedback();
    System.out.println("name :" + name)
    System.out.println("comments :" + comments)
                       
}
Posted by: Guest on October-23-2021

Code answers related to "how to return multiple values from a function in kotlin"

Browse Popular Code Answers by Language