Invalid Expression Term 'Else'

For some reason or another the second ‘else’ in this void is throwing out an exception. None of the normal things that would cause this seem to be present (no semicolons on the end of an if statement for example) so I am unsure what the problem could be. I have tried restructuring the void a bit, but nothing seems to alleviate the issue. Any help would be deeply appreciated.

void stateInAir(){

		HandleHorizontalInput();

		if (canJump) {

			CanDoubleJump = true;
			
			if (inputHoldTime < maxJumpButtonHoldTime && Input.GetKey (KeyCode.Space)) {

				inputHoldTime += Time.deltaTime;

				GetComponent<Rigidbody2D> ().velocity += new Vector2 (0, thePlayer.JumpAccel ());

			} else {

				if (Input.GetKeyDown (KeyCode.Space) && CanDoubleJump == true) {

					setState (PlayerStates.ENTER_JUMP);

					CanDoubleJump = false;
	
					canJump = false;
				}
			} 


			else {

				checkForGround ();

			if (onGround) {
				
					HandleLandOnGround ();

	       }
	    }
	}
}

Based on your current bracketing the statement goes like this:

if (...)
{
    //...
}
else
{
   //...
}
else
{
   //...
}

An if-else statement can’t have more than one else statement so you either need to use an else if (…) or restructure your brackets correctly.

As a side note, what you are referring to as a void is in fact called a method. The word void in this case indicates that the method has no return value. Method names should be formatted LikeThis.

Hope this helps!