Skip to content

Instantly share code, notes, and snippets.

@jbarros35
Created April 16, 2018 13:10
Show Gist options
  • Save jbarros35/4ebca639123a76f62280fa911446a694 to your computer and use it in GitHub Desktop.
Save jbarros35/4ebca639123a76f62280fa911446a694 to your computer and use it in GitHub Desktop.
In Out sample Swift
var param = "try change me brother"
func defaultFunc(_ param:String) {
// param = "I change you" won't compiles
}
defaultFunc(param)
print(param) // try change me brother
func inOutFunc(_ param :inout String) {
param = "I changed you"
}
inOutFunc(&param) // needs explicit &
print(param) // I changed you
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment