Break out of Loop with Array Condition

后端 未结 1 1025
长发绾君心
长发绾君心 2021-01-29 05:53

I\'m currently making a Chutes and Ladders game for class. The win condition for this game is if a player lands on Square 100, they win. If they happen to go past 100, they stay

相关标签:
1条回答
  • 2021-01-29 06:46

    To break out of the inter for loop when your WIN condition is met, you can use the keyword break. This will stop the loop processing regardless of the conditional on the for loop.

    Note however after breaking out, the program will still iterate around your while loop until it's conditional done != true is met.

    0 讨论(0)
提交回复
热议问题