Created
June 6, 2017 16:54
-
-
Save airspeedswift/d2929941c6c1caa92a69f50b7d2c79c0 to your computer and use it in GitHub Desktop.
Multiline Literals
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 tellJoke(name: String, character: Character) { | |
let punchline = name.filter { $0 != character } | |
let n = name.count - punchline.count | |
let joke = """ | |
Q: Why does \(name) have \(n) \(character)'s in their name? | |
A: I don't know, why does \(name) have \(n) \(character)'s in their name? | |
Q: Because otherwise they'd be called \(punchline). | |
""" | |
print(joke) | |
} | |
tellJoke(name: "Edward Woodward", character: "d") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment