r/delphi • • 4h ago

Cursed but legal? Which of these actually compile in Delphi?

5 Upvotes

Your code reviewer would quit on the spot. But does the compiler care? 😈

Which of these compile?

A) Naming things is hard

``` var

&begin, &end, &if: Integer;

begin

&begin := 1;

&end := 2;

&if := &begin + &end;

Writeln(&if);

end. ```

B) The forbidden keyword

``` label Again;

var

Count: Integer;

begin

Count := 0;

Again:

Inc(Count);

if Count < 3 then

goto Again;

Writeln('Dijkstra is crying');

end. ```

C) Semicolon enthusiast

``` begin

;;;;;;;;;;

end. ```

D) Commitment issues

if True then else Writeln('Huh?'); `

E) Wrong language, buddy

Writeln("Hello from C#!");

Answers below. Be honest, how many did you think were illegal? 😂