Exit the loop and continue the loop

					退出循环和继续循环
开发工具与关键技术:
作者:赵纯雨
班级:1804
撰写时间:2019.5.25

In this writing, what I want to write is to exit the loop and continue the loop. In the for...while, while loop, use the break statement to exit the current loop and execute the following code directly. The format is as follows:
For(initial condition: judgment condition: loop After condition value update) { If (special case) (break) loop code } Var a = [70, 80, 66, 90, 50, 100, 89]; define the array mynum and assign Var i = 0; the condition is not established, no Enter the body of the loop, but the code is executed from top to bottom. When it is equal to 50, this condition is established. If it is established, it will come in and end the loop body, as shown in the following figure: Continue the loop continue, the function of continue is just to jump After this loop, the entire loop continues to execute. Statement structure: For (initial condition: judgment condition: condition value update after loop) { If (special case) {continue} loop code }






Insert picture description here
Insert picture description here






Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44540773/article/details/90632544