Created
January 16, 2014 08:05
-
-
Save f81/8451357 to your computer and use it in GitHub Desktop.
第17章:Scalaの演算子 ref: http://qiita.com/f81@github/items/1e72244cdac7ea512bbb
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
scala> 1 + 2 | |
res0: Int = 3 | |
scala> 3 - 1 | |
res1: Int = 2 | |
scala> 4 * 2 | |
res2: Int = 8 | |
scala> 6 / 3 | |
res3: Int = 2 | |
scala> 7 % 2 | |
res4: Int = 1 |
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
scala> 2 > 1 | |
res0: Boolean = true | |
scala> 2 >= 2 | |
res1: Boolean = true | |
scala> 3 < 1 | |
res2: Boolean = false | |
scala> 3 <= 2 | |
res3: Boolean = false | |
scala> 1 == 1 | |
res4: Boolean = true | |
scala> 1 != 1 | |
res5: Boolean = false |
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
scala> ( 2 == 2 ) && ( 1 == 1 ) | |
res0: Boolean = true | |
scala> ( 2 == 2 ) && ( 1 > 1 ) | |
res1: Boolean = false | |
scala> ( 2 == 2 ) || ( 1 > 1 ) | |
res2: Boolean = true | |
scala> ( 2 < 2 ) || ( 1 > 1 ) | |
res3: Boolean = false | |
scala> !( 2 == 2 ) | |
res4: Boolean = false | |
scala> !( 2 > 2 ) | |
res5: Boolean = true |
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
scala> 5 & 6 | |
res1: Int = 4 | |
scala> 5 | 6 | |
res2: Int = 7 | |
scala> 5 ^ 6 | |
res3: Int = 3 | |
scala> ~3 | |
res4: Int = -4 | |
scala> 5 << 1 | |
res5: Int = 10 | |
scala> 5 >> 2 | |
res6: Int = 1 | |
scala> -1 >>> 31 | |
res7: Int = 1 |
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
scala> var a = 3 | |
a: Int = 3 | |
scala> a *= 4 + 1 | |
scala> a | |
res2: Int = 15 |
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
scala> var a = 3 | |
a: Int = 3 | |
scala> a *= (4 + 1) | |
scala> a | |
res4: Int = 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment