Created
June 15, 2011 18:34
-
-
Save chrislewis/1027766 to your computer and use it in GitHub Desktop.
statement-vs-expression
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
// It's a statement. | |
int bInt = 0; | |
if (cond) | |
bInt = 1; | |
else | |
bInt = 0; | |
// It's an expression. | |
val bInt = if (cond) 1 else 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment