Showing posts with label KOTLIN TUTORIAL. Show all posts
Showing posts with label KOTLIN TUTORIAL. Show all posts
Sunday, 22 July 2018
kotlin for loop
fun main(args:Array<String>) { for (item in 1..5) { println("hey theree $item") } }
- OUTPUT
- hey theree 1
- hey theree 2
- hey theree 3
- hey theree 4
- hey theree 5
fun main(args:Array<String>) { for (item in 0..6) { if (item % 2 ==0) {//if the no is divisible by 2 or multiple of 2 println(" $item is multiple of $item fizz") } else if(item%3==0) { println("buzz") } } }
- OUTPUT
- 0 is multiple of 0 fizz
- 2 is multiple of 2 fizz
- buzz
- 4 is multiple of 4 fizz
- 6 is multiple of 6 fizz
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
Friday, 20 July 2018
Thursday, 19 July 2018
kotlin read line method
fun main(args:Array<String>) { println("==========================") println("-->WELCOME TO OUR SHOP<--") println("==========================") println("HELLO WHAT CAN WE DO FOR YOU") var customerResponse= readLine() println("yes indeed we have fresh bread off the oven") var customersecondresponse= readLine() println("==========================") println("==========================") }
- OUTPUT >>>
- ==========================
- -->WELCOME TO OUR SHOP<--
- ==========================
- HELLO WHAT CAN WE DO FOR YOU
- hi
- yes indeed we have fresh bread off the oven
- no
- ==========================
- ==========================
- Process finished with exit code 0
Search This Blog
Categories
Popular Posts
-
https://www.quora.com/Does-associate-Android-developer-exam-Google-developer-certification-worth-it-for-developer-have-six-months-experi...
-
'C:\Users\viraj\AppData\Local\Android\sdk\platform-tools\adb.exe,start-server' failed -- run manually if necessary Solution ...
-
how to make crores from 1 lakh in stock markets in 1 year
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