Last active
May 10, 2016 10:02
-
-
Save omochi/14cfb2a8059e11101e96673619b950c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
// valは定数(再代入禁止) | |
val a = 3 | |
// if文が三項演算子みたいに機能するので定数定義の右辺値にできる。 | |
// さらにifとelseの本文両方からの型推論が効いて、bの型はStringになっている | |
val b = if (a > 1) { | |
"big" | |
} else { | |
"small" | |
} | |
print(b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment