How to use a var with function's parameter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use a var with function's parameter

The compiler complaints when I use var keyword in functionc declaration. I tried this example in Playgrounds and it doesn't work. func myFunc(var num1: Int) -> Int { // function's body }

20th Mar 2017, 12:10 PM
Vitalii Kravets
1 Answer
0
Did you make sure this is the correct code?
21st Mar 2017, 4:24 AM
Coder's Lyceum
Coder's Lyceum - avatar