Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. extension String.StringInterpolation {
  2. mutating func appendInterpolation(if condition: @autoclosure () -> Bool, _ literal: StringLiteralType) {
  3. guard condition() else { return }
  4. appendLiteral(literal)
  5. }
  6. }
  7.  
  8. let age = 19
  9. print("Driving Result: \(if: age > 18, "You can drive the car")")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement