Using for loop to query an array

I’m setting up scripts that will allow multiple firing options on my weapons. The following function is meant to determine which script to use for the gun based on the fire mode.
Apparently C# doesn’t let me do a for loop in this way, is there another way I could do this without needing to define a size?
This is the error I’m getting:
Assets/fireingMode.cs(265,29): error CS1002: Expecting ‘;’

void getGunType(int t){
 gScripts = transform.parent.GetComponents<Gun>();
 for (Gun g in gScripts){
  if(t == 0  g.isPrimaryWeap){
   gScript1 = g;
  }
  else if(t == 1  !g.isPrimaryWeap){
   gScript1 = g;
  }
}

foreach!

lol, funny thing is I kept saying foreach in my head when I read it, but I didn’t realize that I needed to use it. hahaha

You don’t need it with javascript. But you do with C# :smile:.