Why in the most programming languages required to put a semicolon after statements but not after things like if
elseif
and else
?
Do the compilers all look out for newlines? If that's true then why wouldn't they do that for all statements?
Am I missing something? It really doesn't make sense to me...
Usually the semicolon is required because the compilers ignore most whitespace. It's not needed after statements like if, elseif, else because it's not the end of the statement. Those are only complete statements when followed by a statement or block of statements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With