티스토리 뷰

공부

[kotlin] repeat(n) { ... }

승가비 2023. 2. 23. 01:13
728x90

https://hwan-shell.tistory.com/244

 

Kotlin] for문, while문 사용법

1. for문 코틀린 for문은 다양한 방식으로 작성될 수 있습니다. 1) 일반적인 for문fun main(args:Array) { for(i: Int in 1..10) print("$i ") //output : 1, 2, 3, 4, 5 ... 10 val len: Int = 5 for(i in 1..len) print("$i ") //output : 1, 2,

hwan-shell.tistory.com

https://stackoverflow.com/questions/49214684/ignore-loop-constant-in-for-loop

 

Ignore loop constant in for loop

In Swift you can ignore the loop constant by using _ like so: for _ in 0...10 { //loop logic here } Is there an equivalent in Kotlin?

stackoverflow.com

 

728x90
댓글