-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kotlin-samples-pusher-bot
committed
Feb 7, 2025
1 parent
17e71da
commit f5abb8f
Showing
7 changed files
with
29 additions
and
38 deletions.
There are no files selected for viewing
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
5 changes: 3 additions & 2 deletions
5
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.2.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
fun main() { | ||
//sampleStart | ||
val b: Int = 10000 | ||
println(b == b) // Prints 'true' | ||
val boxedB: Int? = b | ||
val anotherBoxedB: Int? = b | ||
println(boxedB == anotherBoxedB) // Prints 'true' | ||
|
||
println(boxedB === anotherBoxedB) // false | ||
println(boxedB == anotherBoxedB) // true | ||
//sampleEnd | ||
} |
6 changes: 2 additions & 4 deletions
6
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.3.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
fun main() { | ||
//sampleStart | ||
println(1 + 2) | ||
println(2_500_000_000L - 1L) | ||
println(3.14 * 2.71) | ||
println(10.0 / 3) | ||
val l = 1L + 3 // Long + Int => Long | ||
println(l is Long) // true | ||
//sampleEnd | ||
} |
7 changes: 4 additions & 3 deletions
7
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.4.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
fun main() { | ||
//sampleStart | ||
val x = 5 / 2 | ||
//println(x == 2.5) // ERROR: Operator '==' cannot be applied to 'Int' and 'Double' | ||
println(x == 2) | ||
println(1 + 2) | ||
println(2_500_000_000L - 1L) | ||
println(3.14 * 2.71) | ||
println(10.0 / 3) | ||
//sampleEnd | ||
} |
4 changes: 2 additions & 2 deletions
4
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.5.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
fun main() { | ||
//sampleStart | ||
val x = 5L / 2 | ||
println(x == 2L) | ||
val x = 5 / 2.toDouble() | ||
println(x == 2.5) | ||
//sampleEnd | ||
} |
22 changes: 18 additions & 4 deletions
22
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.6.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
fun main() { | ||
//sampleStart | ||
val x = 5 / 2.toDouble() | ||
println(x == 2.5) | ||
//sampleEnd | ||
//sampleStart | ||
// Operand statically typed as floating-point number | ||
println(Double.NaN == Double.NaN) // false | ||
|
||
// Operand NOT statically typed as floating-point number | ||
// So NaN is equal to itself | ||
println(listOf(Double.NaN) == listOf(Double.NaN)) // true | ||
|
||
// Operand statically typed as floating-point number | ||
println(0.0 == -0.0) // true | ||
|
||
// Operand NOT statically typed as floating-point number | ||
// So -0.0 is less than 0.0 | ||
println(listOf(0.0) == listOf(-0.0)) // false | ||
|
||
println(listOf(Double.NaN, Double.POSITIVE_INFINITY, 0.0, -0.0).sorted()) | ||
// [-0.0, 0.0, Infinity, NaN] | ||
//sampleEnd | ||
} |
18 changes: 0 additions & 18 deletions
18
...urces/test-compile-data/jvm/kotlin-web-site/numbers/f56d9449111795feee96b7f922b3320d.7.kt
This file was deleted.
Oops, something went wrong.