How to write Swift code if your character is blocked AND on a gem?

0 votes
asked by about Swift Playgrounds
edited by

Write Swift code for if your character is blocked AND on a gem: Collect the gem and turn around.

1 Answer

0 votes
No avatar answered by (79.7k points)

You can write Swift code to collect the gem and turn around using conditional statements. For example, you can use an "if" statement to check if your character is blocked and on a gem, and then use the "collectGem()" and "turnAround()" commands within the same block of code. Here's an example:

if isBlocked && isOnGem {
collectGem()
turnAround()
}

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...