Cogito, ergo sum

While loop

From Unreal Wiki, The Unreal Engine Documentation Site

(Redirected from While)
Jump to: navigation, search

The while loop is a basic loop statement in UnrealScript, similar to the for loop and the do...until loop.

[edit] Syntax

The while loop syntax is very similar to that of the if statement:

while (condition) {
  ...
}

The condition must be a bool type expression. The code between the parentheses is executed repeatedly until either the condition becomes False or a break statement is encountered.

Similar to the if statement, a while loop can be used to repeat a single statement instead of a block of code:

while (condition)
  statement;

This notation should be used with care because the statement could be the empty statement (a single semicolon), which would mean the loop only repeatedly evaluates its condition.

Personal tools