fork(2) download
  1. {$mode objfpc}
  2. {$modeswitch typehelpers}
  3. uses SysUtils;
  4.  
  5. type
  6. TPetuh = type helper for LongInt
  7. function AssString(const aFormat: String): String;
  8. end;
  9.  
  10. function TPetuh.AssString(const aFormat: String): String;
  11. begin
  12. Result := Format(aFormat, [Self]);
  13. end;
  14.  
  15. begin
  16. WriteLn(LongInt(42).AssString('Ответ на главный вопрос: %d.'))
  17. end.
Success #stdin #stdout 0s 576KB
stdin
Standard input is empty
stdout
Ответ на главный вопрос: 42.