Please find the below examples for better understanding: Example# 5 If statement is for multiple purposes like to compare array or character vectors. Since neither of the above two expressions are true it will execute the else block and display the output as 2. The first expression is xy which is also false. In Example 4, x and y values are assigned as 5. First statement checks whether the condition is true or not, here the expression is to check whether xy which is true, so it will execute the subsequent statement and display the output as z =1. In Example 3, x and y values are assigned as 5 and 3. Please find the above two examples describing the working of elseif statement. Else if block is used between if statement and else statement.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |