The function of the continue statement is to end the current loop and enter the next loop. That is, only this loop ends, not all loops end, and subsequent loops still proceed. The continue statement can only be used in loop statements.
In Java language, the continue statement is used to end the current loop and enter the next loop. That is, only this loop ends, not all loops end. , the subsequent loop still proceeds.
(Recommended tutorial: java entry program)
Let’s take a look at an example:
public class Continue { public static void main(String[] args) { int count = 0; for(int i = 1; i <= 10; i++) { if(i == 5) { // 遍历到5的时候,就会跳过当前循环体,当然也不会去执行剩下的语句了。 // 于是就到了下一轮循环(此时i的值是6),所以这里的第5次输出是6而非5,因为5的那一轮循环被跳过了。 continue; } count++; System.out.println("第" + count + "次输出,输出值为" + i); } } }
(Recommended video tutorial: java video Tutorial)
Output result:
The above is the detailed content of What is the function of continue statement. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.