일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- zgc
- datastructure
- JavaScript
- 연산자
- Algorithm
- Class
- While
- JPA
- C++
- programmers
- Fluent-bit
- Sprint Security
- For
- Kotlin
- Java
- 기초
- IAC
- datatype
- 자료형
- jvm
- If
- redis
- Spring Security
- MergeSort
- UserDetails
- SpringBoot Initializr
- ansible
- g1gc
- lambda
- quicksort
Archives
- Today
- Total
목록when (1)
뭐라도 끄적이는 BLOG
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cQAZLv/btsl1VK7gw7/eWzBIoIHK89TITsCBfDmdk/img.png)
Conditional expressions Kotlin은 조건식을 위해 if와 when을 제공한다. if와 when중 when을 사용하는 것을 더 추천한다. If you have to choose between if and when, we recommend using when as it leads to more robust and safer programs. - Kotlin공식 문서 if if를 사용하려면 괄호안에 조건식을 추가하고 중괄호 안에 결과가 참인 경우 수행할 작업을 추가한다. val d: Int val check = true if (check) { d = 1 } else { d = 2 } println(d) // 1 Kotlin에는 삼항 연사자(condition ? then : else)가 없..
Kotlin
2023. 7. 1. 05:53