Guest User

Untitled

a guest
May 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. if case .sugar = sugarcane.taste { // if sugarcane.taste is `.sugar` then
  2. print("yummmmy sugarcane") // enters into if
  3. }
  4. if case .salty(let value) = frenchFries.taste { // frenchFries.taste is .salty(10), so it matches
  5. if value < 10 { // the case and assign the value 10 to `value`
  6. print("manageable") // we can use the `value` inside the `if case`
  7. } else {
  8. print("impossible")
  9. }
  10. }
Add Comment
Please, Sign In to add comment