if (condition1) {
// code to be executed if condition1 is true
} else if (condition2) {
// code to be executed if the condition1 is false and condition2 is true
} else {
// code to be executed if the condition1 is false and condition2 is false
}
if (condition1) {
// block of code to be executed if condition1 is true
} else if (condition2) {
// block of code to be executed if the condition1 is false and condition2 is true
} else {
// block of code to be executed if the condition1 is false and condition2 is false
}
if( name = 'george washington'):
print("You have the same name as the first president of the United States")
// python
else:
print("You do not have the same name as George Washington")
<script type = "text/javaScript">
// JavaScript program to illustrate nested-if statement
var i = 20;
if (i == 10)
document.write("i is 10");
else if (i == 15)
document.write("i is 15");
else if (i == 20)
document.write("i is 20");
else
document.write("i is not present");
< /script>