Thank you Andrej and crokatalontest for helping out earlier.
I have one more scenario where I am not getting to work if and else.
I am trying to test checkout path where user will be offered Product 1 or Product 2 on the page and user will have to select checkbox to add that product into cart and click next to go to next page.
‘Check if the product 1 is present’
if (WebUI.verifyTextPresent('Join The membership!', false) == true)
'Check the checkbox if the product 1 is present'
'else Check if the product 2 text is present '
else (WebUI.verifyTextPresent('Add ThisProduct to your order', false) == true)
'Check the checkbox if the product 2 is present'
For above condition, The test run and try to find product 1 and if the product 1 is not present it throw the error but does not go to product 2