If you are from C or Java background, then the syntax of while
loop will be familiar to you. while
loop evaluates the condition before executing the statements present inside its body.
while(condition){ //code to be executed when condition is true }
fun main(args: Array<String>){ var i = 1 while(i<=10){ println(3*i) i++ } }
Output
3 6 9 12 15 18 21 24 27 30