Switch |
Top Previous Next |
DescriptionThe Switch statement allows the user to set up a series of Cases and a Default, one of which will be executed, depending on the value of an input argument. For more information, see Flow Control Script Reference.
Syntax
Details•The "Case" must be a literal number or string and must evaluate to an integer. Variable or String objects cannot be used, to prevent conflicts in which the evaluation of the Case changes the value of the Variable or String in question. •If the Switch input argument evaluates to one of the cases, that Case is executed. •If the Switch input argument does not evaluate to any of the Cases, the Default is executed. •A Break statement stops the evaluation of all following Cases (including the Default) and exits the Switch block entirely. •Note that a colon (:) is used after each Case and Default statement, instead of a semicolon (;). •The Break statement can also be used to exit a While or a For loop without completing any remaining iterations of the loop or executing any remaining commands within the loop.
ExamplesUse Switch to determine what type of output will be generated
Use Switch to determine whether to generate output Ephemeris file
Use Switch to maneuver a Spacecraft
See Also•If Statement
|