Advertisement
stevennathaniel

Kotlin : Conditionals and Flow Control

Jan 27th, 2017
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.27 KB | None | 0 0
  1. enum class Enemies{Orc, Skeleton, Pigeon}
  2.  
  3. fun main(args: Array<String>) {
  4.  
  5.     var enemy = Enemies.Orc
  6.  
  7.     println("Enemy was of type " + if (enemy == Enemies.Orc) {
  8.  
  9.         // Do Orc related code
  10.  
  11.         "Orc"
  12.  
  13.     } else {
  14.  
  15.         "Not Orc"
  16.     })
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement