the name "whichnote" does not exist in it's current context

Okay, so i’m getting the error the name “whichnote” does not exist in the current context on all of the if (whichnote [notemark] == 1-5) lines and I have no idea how to fix it. VERY beginner here by the way.

	float number = Random.Range(1, 5);
    
	if (whichnote [noteMark] == 1) 
    {
	    xPos = -0.423f;
    }
    if (whichnote [noteMark] == 2)
    {
	    xPos = -0.225f;
    }
	if (whichnote [noteMark] == 3) 
	{		
		xPos = -0.009f;
	}
	if (whichnote [noteMark] == 4) 
	{
		xPos = 0.2054f;
	}
	if (whichnote [noteMark] == 5) 
	{
		xPos = 0.4119f;
	}

	noteMark += 1;
	timerReset = "y";
	Instantiate (noteObj, new Vector3 (xPos, 1.817911f, -6.038626f), noteObj.rotation);
}

this means that the variable “whichnote” doesn’t exist in the current scope.

Maybe you defined it in a method and call it from a different method.
In which case, you must declare it at the root of the class.

By the way, you should rather use a switch statement rather than several if

public class YourScript : MonoBehaviour
{
    int[] whichnote;
    int noteMark;
    public void YourMethod ()
    {
        switch (whichnote [noteMark])
        {
            case : 1
                // do this
                break;
            case : 2
                // do that
                break;
            case : 3
                // end so on
                break;
        }
    }
}