January 2018
Intermediate to advanced
434 pages
14h 1m
English
Let's see an example of the enum class:
enum class Direction { NORTH,SOUTH,EAST,WEST}fun main(args: Array<String>) { var north_direction=Direction.NORTH if(north_direction==Direction.NORTH){ println("Going North") }else{ println("No idea where you're going!") }}
enum class Direction(var value:Int) { NORTH(1),SOUTH(2),EAST(3),WEST(4)}fun main(args: Array<String>) { var north_direction=1 if(north_direction==Direction.NORTH.value){ println("Going North") ...Read now
Unlock full access