Net-informations.com
SiteMap  | About    

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.

VB.Net

C#

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.

VB.Net

C#

If you want to check more than one conditions then you can use else-if statement .

VB.Net

C#

The following ASP.NET program declare and initialize values to two numbers , num1 and num2 and then check which is greater using if statement.

Default.aspx




Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.cs
default.aspx.vb





net-informations.com (C) 2019    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.