반응형 Development/Kotlin4 [kotlin] also, let, apply, run, with 언제 무엇을 사용해야 할까요? 우선 with 는 다른 항목들과 사용법이 다릅니다. 인자를 받고 블록의 수행된 결과를 반환합니다. 재밋는 점은 마지막 줄의 결과값이 리턴되는데 어떠한 타입도 리턴이 가능합니다. /** * Calls the specified function [block] with the given [receiver] as its receiver and returns its result. * * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#with). */ @kotlin.internal.InlineOn.. 2021. 4. 8. [kotlin] for문 에서 collection withIndex 사용하기 자바에서는 collection을 사용하여 for문을 돌릴때 i = 0, ... kotlin collection 에는 vlaue와 index 를 모두 받는 withIndex 가 있다. val iterator = ('a'..'c').iterator() for ((index, value) in iterator.withIndex()) { println("The element at $index is $value") } (kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/with-index.html) 2021. 4. 2. Kotlin cheat sheet from www.kt.academy 2021. 1. 5. 코틀린 문서 벅역본 from : 최범균GitHub : https://github.com/madvirus/kotlin-web-site 2017. 3. 9. 이전 1 다음 반응형