How to check if a function is called?

Hello,

Is there a way to check if a function is called?

for example:

if(SampleFunction().IsCalled)
{
    //do stuff
}

Have the function return a bool, or have the function change a bool.

ex 1 : changing a bool

bool didFunction = false ;

void SampleFunk()
{
  //do stuff
  didFunction = true ;
}

void Whatever()
{
   if(didFunction)
   {
      //do stuff
   }
}

ex 2 : return bool

void Whatever()
{
   if(SampleFunk())
   {
      //do stuff
   }
}

bool SampleFunk()
{
   bool didSomeStuff = false ;
   //do stuff
   if(certain things got done right etc)
      didSomeStuff = true ;

   return didSomeStuff ;
}

Debug.Log(“In Sample Function!”);
Anywhere in the function you’re trying to call.