home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / colobotdemo / colobotdemo10e.exe / help / cbot / for.txt < prev    next >
Text File  |  2001-07-02  |  1KB  |  35 lines

  1. \b;Instruction \c;for\n;
  2. Syntax:
  3. \s;\c;for ( before ; condition ; end )
  4. \s;{
  5. \s;    \n;Instructions ...\c;
  6. \s;}
  7. \n;
  8. This instruction allows you to execute a certain number of times the instructions contained in the \l;block\u cbot\bloc;.
  9.  
  10. \t;\c;before\n;
  11. This instruction is executed before the first loop instance.
  12.  
  13. \t;\c;condition\n;
  14. This \l;condition\u cbot\cond; determines if another instance of the loop must be executed. It is tested before every instance of the loop. 
  15.  
  16. \t;\c;end\n;
  17. This instruction is executed at the end of every instance of the loop. 
  18.  
  19. The following example is strictly equivalent to a \c;for\n;-loop, but it uses the instruction \c;\l;while\u cbot\while;\n;:
  20. \s;\c;before;
  21. \s;while ( condition )
  22. \s;{
  23. \s;    \n;Instructions ...\c;
  24. \s;    end;
  25. \s;}
  26. \n;
  27. \t;Attention
  28. Do not put a \l;semicolon\u cbot\term; at the end of the line \c;for ( )\n;.
  29.  
  30. The instructions \c;\l;break\u cbot\break;\n; and \c;\l;continue\u cbot\continue;\n; can be useful inside a block following the instruction \c;for \n;.
  31.  
  32. \t;See also
  33. \l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
  34.  
  35.