How to manipulate two buttons with one for loop C#

Hi everyone, can you manipulate two buttons with one for loop? From what it looks like I can only use a for loop once and then you will have to create another for loop for the second button.Otherwise I get an error i does not exist in it’s current context.

    [System.Serializable]

    public class ButtonValue
    {
        public int IntValue = 0;
    }
public List<ButtonValue> Buttons = new<ButtonValue>(4);

Void OnGUI(){
 for (int i = 0; i < Buttons.Count i++)
                if(GUILayout.Button("Button1"GUILayout.Width(125), GUILayout.Height(25)){
++Buttons

}
//error i does not exist in it’s current context
if(GUILayout.Button("Button2"GUILayout.Width(125), GUILayout.Height(25)){
++Buttons
}
}

You need to be sure that the code using the variable i is inside the for block.

Start by adding a { to the end of the line

for (int i = 0; i < Buttons.Count i++)

otherwise only the first statement after it is in the for loop.