@Gustavo 'Gus' Carreno
Actually, that has directly to do with Delphi:
First they thought it would be a good idea to terminate {$IFDEF} with {$ENDIF} and then they had the brilliant idea to have an {$IF X} where
X could be an expression. Fair enough, welcome addition.
So, they implemented the idea by implementing {$IF X} and then closed that with {$IFEND}.
Which is the logical way to distinguish between {$IFDEF}/{$ENDIF} and {$IF X}/{$IFEND}...
Then, after all the
sane computer scientists left the building, one
stupid brain came up with a parser adaptation that allowed {$ENDIF} after {$IF X}??? thus eliminating the distinction between the ending for {$IFDEF} and {$IF X}.... (BIG WTF

, they are supposed to have a degree in CS)
While this seems convenient, that mutilates their meaning, which is quite
different.
Freepascal decided to follow Delphi and so after {$IF}, {$ENDIF} is also allowed and, even worse, they (both Delphi and FPC), deprecated {$IFEND}, which makes no sense to me so I always close {$IF X} with {$IFEND} and always close {$IFDEF} with {$ENDIF}...
But for {$IF}, both are allowed, alas.
A history of good design vs. bad design after the
initiators left the building.
I don't know if I have to be disappointed, or just plainly sad.
So you can do everything you want, but please close {$IF X} with {$IFEND}?
It will save you making mistakes and make the blocks immediately obvious.