Twitter Facebook Delicious Digg Stumbleupon Favorites More

Sunday, 22 July 2018

kotlin when using read line



fun main(args:Array<String>)
{
    println("ENTER A NO BETWEEN 1 - 10")
    var enterno= readLine()!!.toInt()
    when(enterno)
    {
        1-> println("WRONG NO 1")
        2-> println("GET CLOSE 2")
        3-> println("CLOSER 3" )
        4-> println("HMM 4 ")
        5-> println("GOOD 5")
        else->{
            println("sorry you lost")
    }


}
}
  • OUTPUT
  • ENTER A NO BETWEEN 1 - 10
  • 2
  • GET CLOSE 2

  • Process finished with exit code 0
Share:

0 comments:

Post a Comment

Search This Blog

Popular Posts

Pages

how to make crores from 1 lakh in stock markets in 1 year

how to make crores from 1 lakh in stock markets in 1 year

Blogger Tutorials

Blogger Templates

Sample Text

Copyright © ANDROID TUTORIAL CODE | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com & Distributed By Protemplateslab