Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extension String.StringInterpolation {
- mutating func appendInterpolation(if condition: @autoclosure () -> Bool, _ literal: StringLiteralType) {
- guard condition() else { return }
- appendLiteral(literal)
- }
- }
- let age = 19
- print("Driving Result: \(if: age > 18, "You can drive the car")")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement