본문 바로가기
반응형

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 준비 사이트 : https://kotlinlang.org/ 시작 가이드 : https://developer.android.com/kotlin/get-started.html kotlin migration : https://kotlinlang.org/docs/tutorials/kotlin-android.html 1. 개요 JetBrains에서 개발한 언어이다. 간결한 문법을 가지고 있으며, 세미콜론이 옵션이다. JVM 기반의 언어이며, Java간의 상호 운용이 100% 지원된다.[2] 안드로이드, Tomcat[3] , 자바스크립트, Java EE, HTML 5 등을 개발할때 사용할 수 있다고 한다. 현재 공식 1.1.4 버전이 나와 있다. 구글에 의해 Android Studio 3.0부터 안드로이드 공식언어로 추.. 2021. 1. 5.
Kotlin cheat sheet from www.kt.academy 2021. 1. 5.
반응형