2

I'm just starting to learn iOS Development and i'm watching a slightly outdated video on functions. In the video based on swift 2 the instructor did

Ex.

func example(var a: Int){


} 

In swift 3, you can not do this to change the argument passed to a variable, does anyone know how I could do this in the current syntax?

Nirav D
  • 71,513
  • 12
  • 161
  • 183
Paul K
  • 29
  • 2

2 Answers2

2

You need to use var like this in swift 3.0 with function parameter.

func example(a: Int){
    var a = a
}

You can read more about this here SE-0003

Nirav D
  • 71,513
  • 12
  • 161
  • 183
0
func example(a: Int){ // You doen't need to write var for parameters

}
Yagnesh Dobariya
  • 2,241
  • 19
  • 29