Quick actions

cmd+k|ctrl+k

Navigation

Languages

Enumeration

Snippet info

Language

Kotlin

Visibility

public

Author

habib17

Created

2019-10-31T14:34:58Z

Updated

2019-10-31T14:34:58Z

fun main(args : Array<String>){
  //  val colorRed = Color.RED
//    val colorGreen = Color.GREEN
  //  val colorBlue = Color.BLUE
    //println(colorRed)
      val color : Color = Color.GREEN
    println(color)
    whenExpression()
}

/*enum class Color(val value: Int){
    RED(0xFF0000),
    GREEN(0x00FF00),
    BLUE(0x0000FF)
    
}*/

enum class Color{
    RED, GREEN, BLUE
}




//when expression
fun whenExpression(){
    val color: Color = Color.GREEN
    
    when(color){
        Color.RED -> print("Color is Red")
        Color.BLUE -> print("Color is Blue")
        Color.GREEN -> print("Color is Green")
    }
}
INFO