I was wondering the differnce between elseif
and else if
.
I was reading the manual which says if using the braces {}
they are treated the same but only elseif
works when not using the braces.
Also another contributer said:
Note that } elseif() { is somewhat faster than } else if() {
and he backed it up with a benchmark test.
To me it seems like elseif is the true way of saying it and saying:
else if() {...}
is really the equivalent of:
else { if() {...} }
which might explain why its marginally slower.
I am used to using else if
because thats how I do it in other languages as well. I don't really think it matters which way you type it (unless you are not using braces.. but I think its always good to use braces anyways) I was just curious about the underlying details.
Am I correct?