or even simpler:
Note a space can be valid input, so depending on application you may want to simply test for length(s)=0, which is what IsEmpty does.
In a Lazarus GUI application it is much simpler: edit controls listen to VK_RETURN, eg:
// make sure lcltype is in the uses clause!!
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then Caption := 'Enter/Return pressed';
end;
Note this is cross-platform too...
Console apps have an inferred LineEding when using ReadLn, like:
program keytest;
{$ifdef fpc}{$mode delphi}{$H+}{$I-}{$endif}
uses sysutils;
var
s:string;
begin
writeln('Press somekeys or not, then press enter');
readln(s); // LineEnding is always inferred when using ReadLn...
if s.IsEmpty then writeln('Empty') else writeln('NotEmpty: ',s);
end.