And/Or statements

It is possible that some scripts may require a While or If condition that requires multiple values to be evaluated. This situation can normally be handed by nesting If or While statements within each other, but this approach can be hard to follow and often leads to duplicating Steps to handle all the situations.

There are two Features in Cycle scripting to assist with complex decisions: And statements and Executing Scenarios.

And statement

Cycle allows many Steps to be used as a Conditional Step. The Steps within a multi-step Conditional Step must be separated by an "AND". When evaluating a multi-step Conditional Step, Cycle will run the Steps one at a time. If any Step fails, Cycle does not run subsequent Steps within the Conditional Step. If all the Steps pass, the Steps within the If or While statements are run.

The Scenario below shows Cycle prompting the user for two pieces of information. The script will look at the two values entered and scan the screen for an image to determine if the user is or is not a Carolina Panthers fan. If all three Steps pass, then the Step in the If statement is executed; otherwise, the Conditional Step fails and the Step in the Else statement is run.

Feature with And statement

Or statement

There are situations in which you may need an If/While decision to look at multiple conditions and pass if any of the conditions are true. In a traditional programming language, this logic would be addressed with an Or statement. Cycle does not support the use of an Or statement, however the same functionality can be achieved by calling another Scenario in the Conditional Step using the I execute scenario Step. In the figure below, the Feature calls Scenario "North or South Carolina" so that the If statement passes for either "SC" or "NC".

Feature with And statement

results matching ""

    No results matching ""