How do i make it so it cycles trough a list on input?

so i want to make it so when i input, lets say for example “F” it cycles trough a list of either, scripts or functions, cause i want it so i can change weapons on mouse wheel up and down, and so i can change burst type when F is pressed.

You could do something like this :

List<Weapon> weapons; // a list of weapon components
public Weapon weapon // an accessor to get the current weapon
{
    get { return weapons[index]; } // that returns a weapon from the list using an index
}

private int _index;
public int index // an index accessor
{
    get { return _index; }
    set
    {
        _index = value > weapons.Count-1 ? 0 : value; // a ternary operator to cycle through
    }
}

void Update ()
{
    if (Input.GetKeyDown (Keycode.F)
        index ++;
}

thank you very much, new to coding, so i dont really know that much about it…