I need help with this/these statements will u help?

Here’s my code i am trying to write a if statement inside of the waitforseconds statement…

 public int Jump = 3;

IEnumerator Jump1()
{
    if (Input.GetKeyDown("w"))
    {
        if (Jump < 3)
        {
           //its men't to wait 5 seconds before adding a jump instead its not running at all can you help
           yield return new WaitForSeconds(5);
           Jump = (Jump + 1);

            while (Jump < 3) ;
            //its men't to wait 5 seconds before adding a jump instead its not running at all can you help

            yield return new WaitForSeconds(5);
            Jump = (Jump + 1);
        }

    }
}

If it is not running at all I am assuming that you are not calling the function correctly. When checking for input you need to put the if statement inside the “Void Update()” method, because that function will run every frame. The IEnumerator function, or any other functions for that matter, needs to be called from an update method, or from another function that was previously called from the update method. Hope that makes sense, also this is very important when working with IEnumerators, you Do Not call them like normal functions, but like this: “StartCoroutine(Jump1());”

try this:
public int Jump = 3;

	void Update()
	{
		if (Input.GetKeyDown("w"))
		{
			StartCoroutine ("Jump1");
		}

	}

	IEnumerator Jump1()
	{
		if (Jump < 3)
		{
			//its men't to wait 5 seconds before adding a jump instead its not running at all can you help
			yield return new WaitForSeconds(5);
			Jump = (Jump + 1);
			while (Jump < 3) ;
			//its men't to wait 5 seconds before adding a jump instead its not running at all can you help
			yield return new WaitForSeconds(5);
			Jump = (Jump + 1);
		}
	}

/Sorry to inform you but this has sadly not worked if you could please contact me about any further info that would be great
Regards MammothSaturn83
/