SHARE
TWEET

Kotlin : Conditionals and Flow Control

stevennathaniel Jan 27th, 2017 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top