Functions are self-contained blocks of code that perform a specific task. Swift’s functions are very flexible. They can be very simple, such as the print function, or very complex. Here are some examples:
The general format for a function starts with the keyword func, followed by the name of the function, optional arguments, and an optional return ...