「Kotlin入門」while文でcontinueを使うサンプル
書式
while(条件式1) { if(条件式2){ some code continue } }
使用例
fun main() { var m = 10 while (m < 20) { if(m == 18) { m++ continue } println("continue m value is: " + m) m++ } }
実行結果
>kotlinc arkgame.kt -include-runtime -d arkgame.jar
>kotlin arkgame.jar
continue m value is: 10
continue m value is: 11
continue m value is: 12
continue m value is: 13
continue m value is: 14
continue m value is: 15
continue m value is: 16
continue m value is: 17
continue m value is: 19