mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 15:24:09 +03:00
This commit is contained in:
parent
29f41f2802
commit
c1d773eab7
@ -185,13 +185,13 @@ fun main(args: Array<String>) {
|
||||
|
||||
// La función "with" es similar a la expresión de JavaScript "with".
|
||||
data class MutableDataClassExample (var x: Int, var y: Int, var z: Int)
|
||||
val fooMutableDate = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableDate) {
|
||||
val fooMutableData = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableData) {
|
||||
x -= 2
|
||||
y += 2
|
||||
z--
|
||||
}
|
||||
println(fooMutableDate) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
println(fooMutableData) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
|
||||
/*
|
||||
Podemos crear una lista utilizando la función "listOf".
|
||||
|
@ -186,13 +186,13 @@ fun helloWorld(val name : String) {
|
||||
|
||||
// "with" 함수는 JavaScript 의 "with" 구문과 비슷하게 사용됩니다.
|
||||
data class MutableDataClassExample (var x: Int, var y: Int, var z: Int)
|
||||
val fooMutableDate = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableDate) {
|
||||
val fooMutableData = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableData) {
|
||||
x -= 2
|
||||
y += 2
|
||||
z--
|
||||
}
|
||||
println(fooMutableDate) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
println(fooMutableData) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
|
||||
/*
|
||||
"listOf" 함수로 리스트를 만들 수 있습니다.
|
||||
|
@ -189,13 +189,13 @@ fun helloWorld(val name : String) {
|
||||
|
||||
// The "with" function is similar to the JavaScript "with" statement.
|
||||
data class MutableDataClassExample (var x: Int, var y: Int, var z: Int)
|
||||
val fooMutableDate = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableDate) {
|
||||
val fooMutableData = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableData) {
|
||||
x -= 2
|
||||
y += 2
|
||||
z--
|
||||
}
|
||||
println(fooMutableDate) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
println(fooMutableData) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
|
||||
/*
|
||||
We can create a list using the "listOf" function.
|
||||
|
@ -178,13 +178,13 @@ fun helloWorld(val name : String) {
|
||||
|
||||
// "with"函数类似于JavaScript中的"with"用法。
|
||||
data class MutableDataClassExample (var x: Int, var y: Int, var z: Int)
|
||||
val fooMutableDate = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableDate) {
|
||||
val fooMutableData = MutableDataClassExample(7, 4, 9)
|
||||
with (fooMutableData) {
|
||||
x -= 2
|
||||
y += 2
|
||||
z--
|
||||
}
|
||||
println(fooMutableDate) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
println(fooMutableData) // => MutableDataClassExample(x=5, y=6, z=8)
|
||||
|
||||
/*
|
||||
我们可以使用"listOf"函数来创建一个list。
|
||||
|
Loading…
Reference in New Issue
Block a user