Repeat commands in a loop
|
- for each
- Executes a statement or group of statements once for each element in a list.
- for
- Executes a loop once for each increment of a counter.
- while
- Executes a loop until a test condition (boolean expression) is false.
|
Conditionally execute a command
|
- if
- Executes a statement block based on the value of a boolean expression.
- select
- Executes one case from a group of cases.
- switch
- Executes one of the statements that follow, depending on the value of an expression.
|
Handle or raise exceptions
|
- do...except
- Handles an exception rather than having it halt the test case.
- raise
- Raises a user-defined exception.
- reraise
- Re-raises an exception you are handling yourself within a
do...except statement.
|
Transfer flow of control
|
- break
- Transfers control of the script out of the innermost nested
for,
for each,
while,
switch, or
select statement.
- continue
- Begins the next iteration of a
for,
for each, or
while statement without completing the current iteration.
- exit
- Ends execution of the current script.
- goto
- Transfers control to the statement prefixed with the specified label.
- return
- Returns control back to the calling function, optionally passing back a return value.
|