colobot-data/help/cbot/D/break.txt

26 lines
486 B
Plaintext

\b;Instruction \c;break\n;
Syntax :
\s;\c;while ( condition )
\s;{
\s; break;
\s;}
\n;
With this instruction, you can get out immediately of a \c;\l;while\u cbot\while;\n; or \c;\l;for\u cbot\for;\n; loop.
Here is an example:
\s;\c;int i = 0;
\s;while ( true )
\s;{
\s; \n;Instructions ...\c;
\s; i = i+1;
\s; if ( i >= 10 )
\s; {
\s; break;
\s; }
\s; \n;more instructions ...\c;
\s;}
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.