Use a nested if statement to compare two conditions in CSharp
Description
The following code shows how to use a nested if statement to compare two conditions.
Example
//ww w . jav a 2s .c o m
public class MainClass{
public static void Main(){
int intValue = 1500;
string stringValue = " ";
if (intValue < 1000){
System.Console.WriteLine("intValue < 1000");
}else{
System.Console.WriteLine("intValue >= 1000");
if (stringValue == "closed"){
System.Console.WriteLine("closed");
}
}
}
}
The code above generates the following result.