0

Function Parameter Names - with in-out parameter

I don't understand the last blank, someone could help me and explain me the answer? func calc(num: inout Int) { num = num*5 } var a = 8 calc(num: )

21st Dec 2020, 4:56 PM
Starcky
2 odpowiedzi
+ 1
When calling a function/method that uses an inout parameter in Swift, you need to pass the address of '&' the variable 'a' being passed to the function/method. Go to the lesson just before this question and re-read it. Be sure to check out the example code and 'try it'.
21st Dec 2020, 8:44 PM
ChaoticDawg
ChaoticDawg - avatar
0
@chaoticDawg : Thank you for your reply and explanation, very clear !
22nd Dec 2020, 9:05 AM
Starcky