They're branching statements that are usually seen together. Only difference is, you can declare ifstatements all by their lonesome, whereas with elseif, you need a previously declared if.
In terms of pseudocode, it goes like
1 2 3 4 5 6
ifthis condition happens
dothiselseif another condition happens
do that
else // for literally any other case that might happen that's not covered by the previous statements
do another thing
Technically elseif is not a separate construch, but just another if in the else statement:
YFGHNG example is parsed as:
1 2 3 4 5 6 7 8 9
ifthis condition happens {
dothis
} else {
if another condition happens {
do that
} else { // for literally any other case that might happen that's not covered by the previous statements
do another thing
}
}