Last active
April 22, 2017 14:32
-
-
Save wess/4ee7bcb233f6009a1e3506f02c4bfda0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func decorate(func) { | |
| func wrapper(name:String) { | |
| return "<p>\(func(name))</p>" | |
| } | |
| return wrapper | |
| } | |
| @decorate | |
| func getText(name:String) { | |
| return "Hello there \(name), how are you?" | |
| } | |
| let x = getText("Erica") | |
| print("RESULT: \(x)") | |
| // RESULT: <p>Hello there Erica, how are you?</p> |
erica
commented
Apr 13, 2016
func decorate(text:String) -> String {
return "<p>\(text)</p>"
}
func getText(name:String) -> String {
return "Hello there \(name), how are you?"
}
let x = getText("Erica")
print("RESULT: \(decorate(x))")@fpillet: With utmost respect - No shit sherlock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment