Itterate through list on button click

public List<GameObject> top = new List<GameObject>();
    public int topnum=0;
public void changetop()
    {
        Debug.Log ("sucess");
        Debug.Log (top.Count);
        topnum++;
        if (topnum > top.Count - 1)
            topnum = 0;
        for (int i = 0; i >= top.Count; i++) {
            if (i ==topnum)
                top [i].SetActive (true);
            else
                top[i].SetActive(false);
               
        }
    }

I wana iterate through list containing gameobjects and activate next one and deactivate rest.
My above code isnt working. Any1 knows wats wrong

Happy Christmas
Thanks

Are there any errors being thrown? Have you put items into the list to test them?
This code should also help:

top[topNum].SetActive(false);
topNum = (topNum + 1) % top.Count;
top[topNum].SetActive(true);

Thanks
Your code works but mine doesnt weird

That’s alright I suspect the problem was with the for loop, in your original script.

for (int i = 0; i >= top.Count; i++)
// Should probably be
for (int i = 0; i < top.Count; i++)

Yes, he used greater than or equal To, not less than.