This is the part 1 of the series of the Tutorials of Swift programming. You can take a quick look at the Introduction to Swift.
In this Tutorials we will learn about
In this Tutorials we will learn about
Functions
Use func to declare a function. Call a function by following its name with a list of arguments in parentheses. Use -> to separate the parameter names and types from the function’s return type.
Few Points of Functions:
- Functions can return multiple values using Tuples
- Functions can accept variable number of parameters and collect them into an array.
- Nested functions
- Functions can accept other functions as parameters.
- Functions can have function as its return value. Because functions are first-class type.
- Functions are special cases of closures