what’s the difference between the below two, are they both one and the same?
if(condition){
//code
}else{
if(condition){
//code
}
}
if(condition){
//code
}else if(condition){
//code
}
The most important difference is that the first one looks like this:
and the second one looks like this:
Since they are syntactically equivalent, clarity and appearance are the most important issues when deciding which to use. If you keep looking at each one in turn a few times, you’ll see why the second is preferred in almost any language where both are equally usable. 😀