File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
Roadmap/05 - VALOR Y REFERENCIA/kotlin Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 17
17
18
18
open class LuisRetos {
19
19
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 ) {
26
21
println (" Valor de a: $a " )
27
22
println (" Valor de b: $b " )
28
23
}
29
24
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 >) {
33
26
listTwo.add(4 )
34
27
println (" Valor de listOne: $listOne " )
35
28
}
36
29
}
37
30
38
31
fun main () {
39
32
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)
42
37
}
You can’t perform that action at this time.
0 commit comments