Skip to content

Commit d42cabb

Browse files
committed
"mouredev#5 - Kotlin"
1 parent 6f98b75 commit d42cabb

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

Roadmap/05 - VALOR Y REFERENCIA/kotlin/Luis-VB.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,21 @@
1717

1818
open class LuisRetos {
1919

20-
var a = 10
21-
var b = a
22-
23-
fun byValue(a: int, b: Int) {
24-
a = 20
25-
b = 30
20+
fun byValue(a: Int, b: Int) {
2621
println("Valor de a: $a")
2722
println("Valor de b: $b")
2823
}
2924

30-
val listOne = mutableListOf(1, 2, 3)
31-
val listTwo = listOne
32-
fun byReference(a: IntArray, b: IntArray) {
25+
fun byReference(listOne: MutableList<Int>, listTwo: MutableList<Int>) {
3326
listTwo.add(4)
3427
println("Valor de listOne: $listOne")
3528
}
3629
}
3730

3831
fun main() {
3932
val retos = LuisRetos()
40-
retos.byValue()
41-
retos.byReference()
33+
retos.byValue(10, 20)
34+
val listOne = mutableListOf(1, 2, 3)
35+
val listTwo = listOne
36+
retos.byReference(listOne, listTwo)
4237
}

0 commit comments

Comments
 (0)