Declare a function with default values


I want to declare a function which takes one or more parameters, with default values.


// Declare a function with one parameter
// which has a default value set
func sayHello(whom : String = "World") {
    print ("Hello \(whom)!")

// Call it without any parameter
// and the 'default' one will be used

// Let's call it again
// with some parameter

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)