Created
April 16, 2018 13:31
-
-
Save jbarros35/6ee30b24de0ceebc79330ef8945e39b1 to your computer and use it in GitHub Desktop.
Autoclosure Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var customersInLine = ["Alex", "Ewa", "Barry", "Daniella"] | |
print(customersInLine.remove(at:0)) // Alex | |
func serve(customer : @autoclosure () -> String) { | |
print("serving customer \(customer())") | |
} | |
serve(customer: customersInLine.remove(at:0)) // Ewa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment