In-depth method (9)-brackets for method invocation

// Point 9: Procedures or functions without parameters can be omitted when calling (); can also carry 
function MyFun: string ;
 begin 
  Result: = ' ok ' ;
 end ; 

{ Call } 
procedure TForm1.Button1Click (Sender: TObject );
 var 
  s: string ;
 begin 
  s: = MyFun; 
  ShowMessage (s); { ok } 

  s: = MyFun (); 
  ShowMessage (s); { ok } 
end ;

 

Guess you like

Origin www.cnblogs.com/fansizhe/p/12729692.html