This function you have is set up to receive an array of Doubles and let you refer to them as costa: func myfunc(costa: [Double]) { // some code } If you're calling the function like this: myfunc(costa: []) then you're passing in an empty array. [] means an empty array. If you want to pass in some values, you need them in the array, e.g.: myfunc(costa: [1.0, 2.1, 3.2, 4.3]) If you need to return an array of Doubles - or anything - you would use a function like this: func myfunc(costa: [Double]) -> [Double] { // some code return myArray // which would be an array of Doubles } A very useful feature of Swift is the ability to hide the name of the variable, so you don't have to enter it every time. Just put an underscore before the first variable name in the function's signature, i.e.: func myfunc(_ costa: [Double]) { // some code } This lets you access the array of Doubles in costa. To call it you would use: myfunc([1.0, 2.1, 3.2, 4.3]) A similar helpful feature is replacing the underscore wi
Topic:
Developer Tools & Services
SubTopic:
Xcode