Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create your variables here:
- var myPlans = "eat, drink, be merry"
- var friendPlans = myPlans
- // Update `myPlans` here:
- myPlans += ", play video games"
- friendPlans
- myPlans
- /*:
- - callout(Exercise):
- 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.\
- Call the `addDance` function on `myPlans`, and assign the result to `friendPlans`.
- */
- // Define and call your function here:
- func addDance(newPlans: String) -> String
- {
- return newPlans + " but no dancing o.O"
- }
- friendPlans = addDance(newPlans: myPlans)
- friendPlans
- myPlans
- /*:
- - callout(Exercise):
- How do you expect `friendPlans` to change? How do you expect `myPlans` to change?\
- Print both instances to to find out.
- */
- // Check your guess by printing here:
- friendPlans
- myPlans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement