Erm - sorry to say this will but you blundered a little. In his original code he does have a readln statement at the end... And yes, I missed it the first time - who doesn't? otherwise everything else is right on the money. As always.

On my lazarus I would do
Project -> New Project -> New Custom Program.
Its the one that is NOT maintained by lazarus as I find it counter - productive for it to add code I specifically don't want there... But some people find it useful, like half of the community whom use lazarus and tell me its leagues ahead of my plain text IDEs like Geany and programmers notepad. Oh well - I gave it a few goes - it bugged my and I returned to my IDEs. Although the debugger is wonderful - don't let anyone tell you different - I find I prefer ultimate control over my code. Just like sudo mode - it just does it. No questions asked.