C for beginners: The Decision Control Structure
Forms of if
The if statement can take any of the following forms:
if (condition)
do this;
if (condition) {
do this;
and this;
}
if (condition)
do this;
else
do this;
if (condition) {
do this;
and this;
} else
do this;
if (condition) {
do this;
and this;
} else {
do this;
and this;
}
if (condition)
do this;
else {
if (condition)
do this;
else {
do this;
and this;
}
}
if (condition) {
if (condition)
do this;
else {
do this;
and this;
}
} else {
do this;
}