Friday 29 October 2021

Kotlin- When


NOTE :1) Whenever we have more then on condition that condition use "when" its a enhance version of switch condition


fun main(){

val userType = "admin"

when(userType){

"admin"->{

println("You'r admin")

}

"editor"->{

println("You'r editor")

}

"author"->{

println("You'r author")

}

else->{

println("You'r Other")

}

}

}


Output: You'r admin

No comments:

Post a Comment

Kotlin - Observer

 Rxjava -  Observer - Based on data view willl render (react) karega. trotling -> making stream for execution (Means clicks event fire kr...