Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.90 KB | None | 0 0
  1. // Create your variables here:
  2. var myPlans = "eat, drink, be merry"
  3. var friendPlans = myPlans
  4.  
  5.  
  6. // Update `myPlans` here:
  7. myPlans += ", play video games"
  8.  
  9. friendPlans
  10. myPlans
  11.  
  12. /*:
  13.  - callout(Exercise):
  14.  Create a function `addDance` that takes a string, appends a phrase about dancing (like `"and then we dance!"` or `"but no dancing"`, according to your taste), and returns the new string.\
  15. Call the `addDance` function on `myPlans`, and assign the result to `friendPlans`.
  16.  */
  17. // Define and call your function here:
  18. func addDance(newPlans: String) -> String
  19. {
  20.     return newPlans + " but no dancing o.O"
  21. }
  22. friendPlans = addDance(newPlans: myPlans)
  23.  
  24. friendPlans
  25. myPlans
  26.  
  27.  
  28.  
  29. /*:
  30.  - callout(Exercise):
  31.  How do you expect `friendPlans` to change? How do you expect `myPlans` to change?\
  32.  Print both instances to to find out.
  33.  */
  34. // Check your guess by printing here:
  35.  
  36. friendPlans
  37. myPlans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement