Colobot Wiki
Advertisement

Syntax:

do
{
	Instructions ...
}
while ( condition );

This instruction allows you to perform several times the instructions inside the block. The instructions are executed at least once, because the condition is tested only afterwards.

Be careful not to confuse the instruction do { } while ( ); with the instruction while ( ) { }; the latter tests the condition before the instructions in the block are executed. 

Condition[]

The instructions in the block are performed over and over again, as long as the condition is true. 

Here is an example : 

do
{
	p = radar(TitaniumOre);
}
while ( p == null );


Attention
[]

Always put a semicolon at the end of the line while ( ).

The instructions break and continue can be useful inside a block following the instruction do { }.

Advertisement