Recent

Author Topic: function and result  (Read 13702 times)

creaothceann

  • Sr. Member
  • ****
  • Posts: 276
Re: function and result
« Reply #45 on: October 31, 2018, 08:49:38 pm »
Exit() in FreePascal was first. (Not Exit without parameters) Delphi added it later. E.g. D7 doesn't even know that syntax.
It would help if some people have at least a minute grasp of such things. Probably too young.

We were talking about exit in finally.

Thaddy

  • Hero Member
  • *****
  • Posts: 18764
  • To Europe: simply sell USA bonds: dollar collapses
Re: function and result
« Reply #46 on: November 01, 2018, 04:26:16 pm »
Yes? that applies here too.... ? See https://www.freepascal.org/docs-html/rtl/system/exit.html

Confused with Halt()?

Here's proof:
Code: Pascal  [Select][+][-]
  1. {$ifdef fpc}{$mode objfpc}{$H+}{$endif}
  2. uses sysutils;
  3.  
  4. function somefunction:boolean;
  5. begin
  6.   try
  7.     exit(100+4 = 104); //true!
  8.   finally
  9.     Result := false;
  10.   end;
  11. end;
  12. begin  
  13.   writeln(somefunction); // what does that say?
  14. end.
Btw wp already spotted his errant ways. He is forgiven  8)
« Last Edit: November 01, 2018, 04:47:13 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

 

TinyPortal © 2005-2018