본문 바로가기
코틀린

[코틀린] 스위치 (when)

by 아스키의 공부방 2020. 12. 12.
728x90
반응형
            when(rnd) {
                0 -> view.setBackgroundResource(R.drawable.rounding_title)
                1 -> view.setBackgroundResource(R.drawable.rounding_content)
                2 -> view.setBackgroundResource(R.drawable.rounding_blue)
                3 -> view.setBackgroundResource(R.drawable.rounding_purple)
                4 -> view.setBackgroundResource(R.drawable.rounding_yellow)
            }

728x90
반응형