how to call two functions on same button on click

i want to make a button , in which when i click it calls a function “A” and when i click again on it then call a function “B”.
For example on a sound button ,when i click on it, the sound off and when i again click on it then the sound is on.


You need write a method, which can save the current state of the button and set it as click’s handler.

For example:

private bool _soundOn = false;

public void OnButtonClick()
        if (_soundOn)
             SoundOff(); //method that can turn the sound off
             _soundOn = false;
             SoundOn(); //method that can turn the sound on
             _soundOn = true;