This question pertains specifically to shell scripts, but could be about any programming language.
Is there any difference between using multiple if stateme
if (x == 0) {
// 1
}
if (x >= 0) {
// 2
}
if (x <= 0) {
// 3
}
Above code will produce different value than the code below for x=0.
if (x == 0) {
// 1
} else if (x >= 0) {
// 2
} else {
// 3
}
In the first case all the statements 1, 2, and 3 will be executed for x = 0. In the second case only statements 1 will be.