Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
For loop
The for loop is one of four different loop statements in UnrealScript. The others are the Do/Until, While and ForEach loops.
Syntax[edit]
The general syntax of the for loop is as follows:
for (initstatement; loopcondition; updatestatement) statement;
Instead of a single statement, it is more common to follow up with a block of code, even if it only contains a single statement as well:
for (initstatement; loopcondition; updatestatement) { ... }
The initstatement must be exactly one assignment or function call and is executed right before the loop is entered for the first time. The loopcondition must be a bool type expression and is evaluated before each (including the first) loop iteration. If the condition evaluates to False, the loop ends and code execution continues at the first statement after the for loop. The updatestatement must be exactly one assignment or function call and is executed at the end of each loop iteration right before the loop condition is reevaluated. All three parts in the parentheses must be specified. Unlike other languages that allow you to omit these expressions, the UnrealScript compiler will complain if any of them is missing. Also unlike other languages the UnrealScript compiler will complain about comma-separated assignments as initialization or update statements.
Note: The compiler also allows the empty statement (a lonely semicolon) as statement after the for statement. This is basically the same as specifying an empty block of code. Any other statements following the semicolon are not part of the loop! Be wary of this when using the single-statement form of the for loop.
Declarations | Preprocessor • Classes • Interfaces • Cpptext • Constants • Enums • Structs • Variables (Metadata) • Replication block • Operators • Delegates • Functions • States • Defaultproperties (Subobjects) |
---|---|
Types | bool • byte • float • int • name • string • Object • Class • Enums • Structs (Vector ⋅ Rotator ⋅ Quat ⋅ Color) • Static arrays • Dynamic arrays • Delegates • Typecasting |
Literals | Boolean • Float • Integer • Names • Objects (None ⋅ Self) • Vectors • Rotators • Strings |
Flow | GoTo • If • Assert • Return • Stop • Switch • While • Do...Until • For • ForEach • Break • Continue |
Specifiers | Super • Global • Static • Default • Const |
UnrealScript | Syntax • .UC • .UCI • .UPKG • Comments • #directives • Native |