# How to define an enum?

  1. Open the respective .kdata file.

    For example to define lottery status as an enum, open LotteryData.kdata file in eclipse.

  2. Define the enum data using keyword enum as follows:

    enum LotteryStatus => OPEN ("Open") | CLOSE ("Close") | CANCELLED // value defaults to key.
    

    Note: Dont forget to save the file

  3. enter sbt shell, run compile command to access the enum.

# Sample Usage:

def isLotteryOpen(currentStatus: String): Boolean = {
  currentStatus == LotteryStatus.OPEN.name
}

def isLotteryCancelled(currentStatus: LotteryStatus): Boolean = {
    currentStatus == LotteryStatus.CANCELLED
}