Delphi dynamically calling different functions

type
  TNodeFunction = function(AInput: String): String;

implementation

function Func1(AInput: String): String;
begin
   result := AInput;
end;

Open in new window

Then I can do this:
var
  SomeFunc,: TNodeFunction;
begin
     SomeFunc = Func1;
    ....
So far it is good.

But my problem is that a certain place I need to detect in my program that I gave value to SomeFunc or not.

I tried this :
If SomeFunc<> nil Then <- but I get this error [dcc32 Error]  E2008 Incompatible types

Thank you very much for your help!
Member_2_7965240Asked:
Who is Participating?
 
ste5anSenior DeveloperCommented:
You need to use If Assigned(SomeFunc).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.