Hi all, I’m moving to swift from developing with PHP and JavaScript and as an intro have been going through the (quite fun) swift playground lessons. The last lesson - Roll Left Roll Right in learn to code 1 isn’t cooperating with me or I’m missing something obvious.
at the end of the ‘maze’ when byte is blocked I’m having an issue getting the code to exit my while loop.
Code is as follows:
while !(isBlocked && isBlockedLeft && isBlockedRight) {
moveForward()
if isBlocked && isBlockedLeft {
turnRight()
} else if isBlocked {
turnLeft()
}
if isOnGem {
collectGem()
} else if isOnClosedSwitch {
toggleSwitch()
}
}
Any pointers?
at the end of the ‘maze’ when byte is blocked I’m having an issue getting the code to exit my while loop.
Code is as follows:
while !(isBlocked && isBlockedLeft && isBlockedRight) {
moveForward()
if isBlocked && isBlockedLeft {
turnRight()
} else if isBlocked {
turnLeft()
}
if isOnGem {
collectGem()
} else if isOnClosedSwitch {
toggleSwitch()
}
}
Any pointers?