Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler ignores missing parenthesis of Exit command

Why does the Delphi compiler ignore this missing parenthesis?

function Test: Boolean;
begin
  Exit(True;    // <-- eek! it compiles...
end;

I found some of my code looking like this and first thought that Delphi ignores my unit - but it just ignores this type of syntax error. So now of course I want to know why.

like image 498
Heinrich Ulbricht Avatar asked Apr 30 '12 07:04

Heinrich Ulbricht


1 Answers

I'm guessing Exit is considered a token unto itself, and as such anything defined within the same scope after Exit is simply ignored by the compiler (since it cannot execute those instructions anyway).

like image 69
LaKraven Avatar answered Oct 07 '22 04:10

LaKraven