Swift: A function that returns a string

This entry is part 11 of 41 in the series Swift

This is a function that returns a string.

import UIKit

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



Series Navigation<< Swift: Printing out the index in an array
Swift: A function that does not return anything >>

Leave a comment

Leave a Reply