Learn to Code 1 crashed

I was playing around in Learn to Code 1 out of boredom, and I managed to crash the second page... I used the code below, and it worked on a subsequent run, so I'm not entirely sure what happened.


func moveForward(_ spaces: Int) {
    for _ in 0..<spaces {
        moveForward()
    }
}

moveForward(2)
turnLeft()
moveForward(2)
collectGem()