types
This commit is contained in:
parent
0c2ba0586d
commit
3034f98949
7
io/kotlinstudy/tour/Practice.kt
Normal file
7
io/kotlinstudy/tour/Practice.kt
Normal file
@ -0,0 +1,7 @@
|
||||
package io.kotlinstudy.tour
|
||||
|
||||
fun main() {
|
||||
val name = "Mary"
|
||||
val age = 20
|
||||
println("$name is $age years old")
|
||||
}
|
18
io/kotlinstudy/types/BasicTypes.kt
Normal file
18
io/kotlinstudy/types/BasicTypes.kt
Normal file
@ -0,0 +1,18 @@
|
||||
package io.kotlinstudy.types
|
||||
|
||||
fun main() {
|
||||
var customers = 10
|
||||
|
||||
customers = 8
|
||||
println("There are $customers customers")
|
||||
customers = customers + 3
|
||||
println("There are $customers customers")
|
||||
customers += 7
|
||||
println("There are $customers customers")
|
||||
customers -= 3
|
||||
println("There are $customers customers")
|
||||
customers *= 2
|
||||
println("There are $customers customers")
|
||||
customers /= 3
|
||||
println("There are $customers customers")
|
||||
}
|
16
io/kotlinstudy/types/Declare.kt
Normal file
16
io/kotlinstudy/types/Declare.kt
Normal file
@ -0,0 +1,16 @@
|
||||
package io.kotlinstudy.types
|
||||
|
||||
fun main() {
|
||||
val a: Int = 1000
|
||||
println(a)
|
||||
val b: String = "log message"
|
||||
println(b)
|
||||
val c: Double = 3.14
|
||||
println(c)
|
||||
val d: Long = 100_000_000_000_000
|
||||
println(d)
|
||||
val e: Boolean = false
|
||||
println(e)
|
||||
val f: Char = '\n'
|
||||
println(f)
|
||||
}
|
7
io/kotlinstudy/types/Error.kt
Normal file
7
io/kotlinstudy/types/Error.kt
Normal file
@ -0,0 +1,7 @@
|
||||
package io.kotlinstudy.types
|
||||
|
||||
fun main() {
|
||||
val d: Int
|
||||
// println(d)
|
||||
|
||||
}
|
9
io/kotlinstudy/types/SpecifyType.kt
Normal file
9
io/kotlinstudy/types/SpecifyType.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package io.kotlinstudy.types
|
||||
|
||||
fun main() {
|
||||
val d: Int
|
||||
d = 3
|
||||
val e: String = "hello"
|
||||
println(d)
|
||||
println(e)
|
||||
}
|
Loading…
Reference in New Issue
Block a user