Declare a function with inout parameters


I want to declare a function with parameters which it can alter, and call it with a reference.


// Declare a function with 'inout' parameters
func append(inout str:String, withString:String) {
    str += withString
// Declare string variable
var myString = "Hello"

// Call the function with a reference - &
// to our 'myString' variable
append(&myString, withString:" World!")

// The string variable will have now changed

Heard the news?

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