Answers for "how can i Use Do while in Kotlin"

0

how to do a while loop kotlin

//Here is how to do a while loop in kotlin!
//It is very similar to the syntax of javscript if youa have worked with the langauge!

// Program to print line 5 times

fun main() {

    var i = 1

    while (i <= 5) {
        println("Line $i")
        ++i
    }
}

//this will print 5 times!
Line 1
Line 2
Line 3
Line 4
Line 5




//If your try copying and pasting the code put it in this function! Hopefully it will print!

fun main(args: Array<String>) {

println("Hello Bob")

}
Posted by: Guest on July-26-2021

Browse Popular Code Answers by Language