Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "QuakeC Loops and Conditions"

From Quake Wiki

(New page: === Loops and conditions === == Conditional construct == if( expression ) { statements } else { statements } == Loop construct == while( exp...)
 
(Loop construct)
Line 17: Line 17:
 
== Loop construct ==
 
== Loop construct ==
  
 
+
Pre-test loop: Checks the expression before executing the code within the loop.
 
     while( expression )
 
     while( expression )
 
     {
 
     {
Line 23: Line 23:
 
     }
 
     }
  
or
+
or post-test loop: Check the expression after the first execution.
  
 
     do
 
     do

Revision as of 18:34, 7 May 2008

Loops and conditions

Conditional construct

   if( expression )
   {
     statements
   }
   else
   {
     statements
   }


Loop construct

Pre-test loop: Checks the expression before executing the code within the loop.

   while( expression )
   {
     statements
   }

or post-test loop: Check the expression after the first execution.

   do
   { 
     statements
   }while( expression )