0x00 Lesson
You can exit a loop at any time using the break
keyword. To try this out, let’s start with a regular while
loop that counts down for a rocket launch:
In this case, the astronaut in command gets bored part-way through the countdown and decides to skip the remainder and launch straight away:
With that change, as soon as countDown
reaches 4 the astronaut’s message will be printed, and the rest of the loop gets skipped
0x01 我的小作品
欢迎体验我的作品之一:小编辑器-XCompiler
在线编辑器~小而巧
App Store
搜索即可~