"else if" is essentially a keyword it's self. It does not enter a new scope, though the code in your example IS valid. What your code equates to is... If a == 1, do action x. If a != 1, then... (If b == 1, do action y)
What else if does, is...
If a==1, action x. If a!=1 AND b==1, action y.
"else if" can be compared to a switch statement, but expanded. Once one condition is met, the rest are skipped.
if or elseif by themselves don't create a new scope. The braces at lines 1/3 and 5/7 each create a scope. So in each case, // blah is in a separate scope.