How to use value from a function in another function

Hi ,i need some help using same Variable in 2 differents function which are in the same script/class
I need to use the value of the variable which is seted randomly in function A but when i use it in function B the value is equal to 0.
My function are both void i can’t make it Int because it is atached to a button.
I have try different thing like use pointer but it dont work with unity i get some kind of error , can someone help me? ^^

Ps:Please dont send me link to a tutorial i already watch alot it will not help me,just tell if it is possible or not and if yes how? Sorry for my bad english #thankyou

Just declare your variables outside of the functions :wink:

public class SomeClass : MonoBehaviour
{
  string someStringValue = "state1";

  void Update()
  {
    MethodNumber1();
  }

  void MethodNumber1()
  {
    if(someStringValue == "state1")
      someStringValue = "state2";

    MethodNumber2();
  }

  void MethodNumber2()
  {
    if (someStringValue == "state2")
      someStringValue = "state1";
  }
}