1. function
//// function
val price1 = 100
val price2 = 200
val price3 = sumPrice(price1, price2)
println("price3 = $price3")
ex1.
fun sumPrice(price1: Int, price2: Int): Int {
return price1 + price2
}
ex2.
fun sumPrice(price1: Int, price2: Int): Int = price1 + price2'개발이 좋아서 > Kotlin이 좋아서' 카테고리의 다른 글
| [Api 만들기] (0) | 2024.01.02 |
|---|---|
| [spring setting] (0) | 2024.01.02 |
| [class / interface] (1) | 2024.01.02 |
| [if / when] (0) | 2024.01.02 |
| [변수 알아보기] (1) | 2024.01.02 |