Mel Array Issue

Hey guys I am having a problem with my mel script where declaring an array inside of an if statement is causing an error. My original code that was working was:

string $cog[] = `polyCylinder -n "gear#" -sx $densityInput -h $thicknessInput -r $radiusInput`;
select $cog[0];

Once I add the if statement,

if ($gearType == 1) 
{
    string $cog[] = `polyCylinder -n "gear#" -sx $densityInput -h $thicknessInput -r $radiusInput`;
}
select $cog[0];

I get the error "Error: line 139: No object matches name: // "
Any idea what would be making this happen?
Thanks guys
-Brian

If you declare the array inside the scope of the if statement, it doesn’t exist once you exit the scope. Declare the array above the if, fill it out inside the if, and it will still be around when you’re done