I enjoy listening to National Public Radio's Wait Wait Don't Tell Me" on saturday mornings. "Wait Wait" is a show in which listeners call in and are quizzed (in very humorous fashion) by normally respectable newscasters and radio personalities, and if they get their quizzes right, the big prize is Carl Kassel's voice on your home answering machine.
One of the most entertaining segments of the program is one they call "Bluff the Listener," where three of the personalities tell a story, supposedly from the national news of the prior week. Only one of the stories is true, and the goal is to choose which of the three is real.
This week, we're going to play "Bluff the Programmer." I'm going to give you three snippets of code. Only one of them is, in fact, valid Delphi code. You pick the right one.
Oh, and actually testing the code is highly discouraged, as that would make it too easy.
Option #1:
-
Memo1.Lines.Add(Format('1: %s' + ^M + '2: %s', [Edit1.Text, Edit2.Text]));
Option #2:
-
property Publisher: string read 'TwoDesk Software Company';
Option #3:
-
procedure Button1Click(Sender: TObject);
-
begin
-
case Sender of
-
Button1: Form1.Show;
-
Button2: Form2.Show;
-
end;
-
end;
That's it. Two of those are illegal. One works. Which is which?
(Edited about 9 hours after posting for a couple of typos)