Control Structures: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Dj d
Filled out some basics.
 
imported>Dj d
No edit summary
Line 1: Line 1:
== if/else ==
== if/else ==
if (boolean)
if (boolean)
{}
{}
else if
else if
{}
{}
else
else
{}
{}



Revision as of 03:11, 27 September 2009

if/else

if (boolean)

{}

else if

{}

else

{}

while

while (boolean) {}

for

for x from a to b by c

is the general case. You don't need to specify whether it's going up or down - although doing so by using upto or downto does allow a runtime check to make sure you didn't screw up.

If you don't specify "c", it defaults to incrementing/decrementing by 1.