Guest User

Untitled

a guest
Jun 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. /* syntax:
  2. public func preconditionFailure(
  3. _ message: @autoclosure () -> String = default,
  4. file: StaticString = #file,
  5. line: UInt = #line) -> Never
  6. */
  7. func validateAge(age: Int) -> Bool {
  8. guard age >= 3 else {
  9. preconditionFailure("Age can't be less than 3")
  10. }
  11. return true
  12. }
  13.  
  14. _ = validateAge(age: 2)
Add Comment
Please, Sign In to add comment