fork download
  1. program ideone;
  2.  
  3. function GetError(a, b, c, d: string): string;
  4. begin
  5. GetError := a;
  6. if ((GetError <> '') and (GetError <> '0')) then
  7. GetError := b
  8. else
  9. begin
  10. GetError := c;
  11. if ((GetError <> '') and (GetError <> '0')) then
  12. GetError := d;
  13. end;
  14. if (GetError = '0') then
  15. GetError := '';
  16. end;
  17.  
  18. begin
  19. writeln('Without error');
  20. // Last_OI_Errno,Last_IO_Error, Last_SQL_Errno, Last_SQL_Error
  21. writeln('Start 1 -> ' + GetError('', '', '', ''));
  22. writeln('Start 2 -> ' + GetError('0', '', '', ''));
  23. writeln('Start 3 -> ' + GetError('', 'Error1', '', ''));
  24. writeln('Start 4 -> ' + GetError('', '', '0', ''));
  25. writeln('Start 5 -> ' + GetError('', '', '', 'Error2'));
  26.  
  27. writeln('With error');
  28. writeln('Start 1 -> ' + GetError('12', '', '', ''));
  29. writeln('Start 2 -> ' + GetError('12', 'Error 12', '', ''));
  30. writeln('Start 3 -> ' + GetError('0', '', '2', 'Error 20'));
  31.  
  32. end.
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
Without error
Start 1 -> 
Start 2 -> 
Start 3 -> 
Start 4 -> 
Start 5 -> 
With error
Start 1 -> 
Start 2 -> Error 12
Start 3 -> Error 20