This is my first time every playing in Swift Playground. Total coding newbie. As I started playing in the playground, I just couldn't stop. These puzzles are really fun. Although this one command in particular is kicking my butt. Here is the command:
And here is a screenshot.
For me, this says "as long as the path is not blocked AND is not sitting on an open or closed switch", then the statement would be true. However, the character just keeps walking through this command. Here is a screencast:
https://www.screencast.com/t/5QJXBl71
Right at 30 seconds, the little character continues to walk forward. But why? Since the character is sitting on a closed switch, shouldn't the character stop?
Doesn't "!isOnClosedSwitch" = is not on a closed switch?
Please help.
Code:
while !isBlocked && !isOnClosedSwitch || !isOnOpenSwitch {
moveForward()
}
And here is a screenshot.
For me, this says "as long as the path is not blocked AND is not sitting on an open or closed switch", then the statement would be true. However, the character just keeps walking through this command. Here is a screencast:
https://www.screencast.com/t/5QJXBl71
Right at 30 seconds, the little character continues to walk forward. But why? Since the character is sitting on a closed switch, shouldn't the character stop?
Doesn't "!isOnClosedSwitch" = is not on a closed switch?
Please help.