📄 break.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>break</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">C/C++ Keywords</a> > <a href="break.html">break</a> </div> <div class="name-format"> break </div> <p>The break keyword is used to break out of a <a href= "do.html">do</a>, <a href="for.html">for</a>, or <a href= "while.html">while</a> loop. It is also used to finish each clause of a <a href="switch.html">switch</a> statement, keeping the program from "falling through" to the next case in the code. An example:</p> <pre class="example-code"> while( x < 100 ) { if( x < 0 ) break; cout << x << endl; x++; } </pre> <p>A given break statement will break out of only the closest loop, no further. If you have a triply-nested for loop, for example, you might want to include extra logic or a <a href="goto.html">goto</a> statement to break out of the loop.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="continue.html">continue</a><br> <a href="do.html">do</a><br> <a href="for.html">for</a><br> <a href="goto.html">goto</a><br> <a href="switch.html">switch</a><br> <a href="while.html">while</a> </div> </div> </td> </tr> </table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -