if else statements
The conditional statement IF-ELSE is using for check the conditions that we provided in the head of if statement and making decision based on that condition. The conditional statement examining the data using comparison operators as well as logical operators.
If the given condition is true then the control goes to the body of if block , that is the program will execute the code within if block. If the condition is false then the control goes to next level , that is if you provide else block the program will execute the code block of else statement, otherwise the control goes to next line of code.
The else statement is optional , so yo can use if statement without else statement.
If you want to check more than one conditions then you can use else-if statement .
The following ASP.NET program declare and initialize values to two numbers , num1 and num2 and then check which is greater using if statement.
Click the following links to see full source code