Title here
Summary here
Here’s a function that will take an arbitrary number of int
s as arguments.
Variadic functions can be called in the usual way with individual arguments.
If you already have multiple args in an array, apply them to a variadic function using the spread operator nums...
like this.
You can run this program by pasting the code into a Swift playground or saving it into a .swift
file and running it with the Swift command-line tools.
Another key aspect of functions in Swift is their ability to form closures, which we’ll look at next.
Next example: Closures.