--- tags: English --- # Control Flows in SideeX SideeX supports 4 types of control constructs: `IF-ELSE`, `WHILE`, `INCLUDE` and `TRY-CATCH`. These 4 types of control constructs can be interleavingly used. ## IF-ELSE An IF command should be paired with one END command and can be paired with only one ELSE command. Besides, it can be nested. The followings are valid combinations: :::info **Example 1 (IF-END)** IF *Other Commands* END ::: :::info **Example 2 (IF-ELSE-END)** IF *Other Commands* ELSE *Other Commands* END ::: :::info **Example 3 (Nested-IF)** IF *Other Commands* **IF** *Other Commands* **ELSE** *Other Commands* **END** *Other Commands* END ::: ## WHILE A WHILE command should be paired with one END command. The value of the command can be set to a maximum number of loops. A blank value means no restriction on the number of loops. :::info **WHILE \| \${ValidLogin} == false \| 10** *Other Commands* IF \| "${LoginStatus}" == "Incorrect Name" \| *Other Commands* END *Other Commands* **END** ::: ## INCLUDE The INCLUDE command is a powerful control construct for test case reuse. The command enables another test case to be included and executed while playing. The test case to be included can be designated by the following format: `TestSuiteName.TestCaseName` In the following example, LoginTestCase of LoginPageTestSuite will be included and executed while executing the INCLUDE command. :::info IF | ${isSignedIn} == true | **INCLUDE | LoginPageTestSuite.LoginTestCase |** ELSE *Other Commands* END ::: ## TRY-CATCH A `TRY` command should be paired with one `END` command and can be paired with only one `CATCH` command. When a command in a `TRY` scope fails, the rest of the commands in the scope will be skipped without causing test case failure, meanwhile the commands in the `CATCH` scope will continue to be executed if any. The followings are valid combinations: :::info **Example 1 (TRY-CATCH-END)** TRY *Commands May Fail* CATCH *Other Commands* END ::: :::info **Example 2 (TRY-END)** TRY *Commands May Fail* END :::