While

Top  Previous  Next

Description


The While statement contains a block of commands that execute while a conditional statement is evaluated to be true. The While statement always concludes with an End statement. For more information, see the Flow Control Script Reference.

 

 

Syntax


While (mySpacecraft.ElapsedTime.ToMinutes() < 90);
     Step mySpacecraft;
     View mySpacecraft, myGroundStation;
End;
 
While (mySpacecraft.ElapsedTime < TIMESPAN(10 days) and mySpacecraft.A >= 8000);
     Step mySpacecraft;
     View mySpacecraft, myGroundStation;
End;

 

 

Details


The conditional statement is re-evaluated upon the completion of each iteration through the loop.

FreeFlyer exits the loop once the conditional statement is no longer true.

Upon exiting the While loop, FreeFlyer transfers control to the item directly following the corresponding End statement.

It is possible to test for multiple logical conditions using the "and" and "or" operators. See the Flow Control Script Reference for more information.

 

A While statement can depend on an unlimited number of conditional statements. Possible relational conditions are:

o<, <=, >, >=, ==, !=, IsType

 

Additional conditional syntax supported in millisecond timing precision mode only:

ois, not, very, somewhat, almost, usually (used with FuzzySet object only)

o= (equivalent to ==)

o~= (equivalent to !=)

 

A While statement must be closed with an End statement.

To create complex logic flow, you can construct nested loops using multiple While commands, along with For and If statements.

The Break and Continue statements can be used to control logic flow for exiting While loops.

Unlike when working with For loops, properties and methods with a state are not reset at the start of each iteration of a While loop. See Properties and Methods with a State for more information.

 

 

Command Editor


Left side of expression

Defines the object, property, or method that is evaluated to determine whether loop contents will be executed

oArray element

oVariable object

oFreeFlyer object property/method

 

Evaluation Type

 

Evaluation

Definition

==

Equal to

>=

Greater than or equal to

<

Less than

!=

Not equal to

~=

Not equal to

>

Greater than

<=

Less than or equal to

 

Right side of expression

Defines the value that the left side of the expression will be tested against

 

Script

Displays the FreeFlyer Script that is generated by the editor

The ellipsis (...) indicates that additional script can be added inside the loop

 

Description

Displays descriptions of the editor and its fields

Description text changes as the mouse pointer moves over the different fields within the editor

 

 

 

See Also


Break

Continue

For

If

Flow Control Script Reference