Swift: A function that does not return anything

As you can see, we use func to define a function.  The earlier example shows how to define a function that returns a string.  If you do not need the function to return anything, this is how we define it.

import UIKit

func sayHello(personName: String) {
    let greeting = "Hello, " + personName + "!"



Series Navigation<< Swift: A function that returns a string
Swift: Getting the length of a string >>