Declare a function with arguments

 Problem

I want to declare a new function, which takes some arguments, and then call it.



 Recipe


// Declare our new function
func sayHelloTo(name:String) {
    print("Hello \(name)!")
}

// Call it
sayHelloTo("John")


				

Heard the news?

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

 

 Playground