Using a reserved word as an identifier (variable name, class name etc) in Delphi

AKA Silly Delphi Party Tricks #1

Is it possible to use a reserved word as an identifier ?
For example – I want to name my variable or class “BEGIN” because, ummm, well I dont know just because.

Yes you can.  Simply prefix the the name with an ampersand “&” escape character like this

var
   &begin  : integer;  // begin is a reserved word
begin
   &begin  := 123;
end;

Continue reading “Using a reserved word as an identifier (variable name, class name etc) in Delphi”