C++ keyword: continue - cppreference.com

From cppreference.com

Usage

continue statement

: as the declaration of the statement

Example

Run this code

#include<iostream>#include<string>[[nodiscard]]constexprautoget_digits(conststd::string&string)noexcept{std::stringdigits{};for(constauto&character:string){if(character<'0'||character>'9')[[likely]]continue;// conditionally skips the following statementdigits+=character;}returndigits;}intmain()noexcept{std::cout<<get_digits("H3LL0, W0RLD!");}Output:

300 See also

if

statement:

if

,

else

switch

statement:

switch

,

case

default

(as case label declaration) etc:

default

goto

statement:

goto

break

statement:

break

return

statement:

return

do-while

loop and

while loop

:

do

,

while

for

loop and

range-based for loop

:

for