Answers for "return two values 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 numbersMap = mapOf("one" to 1, "two" to 2, "three" to 3)
    for ((key, value) in numbersMap) {
   
        System.out.println("key :" + key)
        System.out.println("value :" + value)
    }  
}
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 "return two values kotlin"

Browse Popular Code Answers by Language