Created
July 23, 2019 18:08
-
-
Save rail-rate/da5bfd225de3808cbb3e76a5c7a54553 to your computer and use it in GitHub Desktop.
break1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random //Random()を使うためには先頭に左側コードを書いておく必要があります | |
fun main(args: Array<String>) { | |
while(true){ | |
val num = Random().nextInt(10) //ここで0から9までの乱数を生成している | |
println("乱数:$num") //ここで決まった乱数を表示している | |
if(num == 0) break //ここで乱数が0ならループから抜ける処理としてbreakを入れている | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment