Question: 'local' dellarations inside if statements, don't work?

I find that if if declare a variable in a procedure inside a if  statement it Maple things something is wrong with the if statement:


global vSound;  

local locMic:=Vector([xMic,yMix,zMix]);  

local locGun:=Vector([xGun,yGun,zGun]);   l

ocal delGunToMix;   if mode=1 then #`direct  `    

local x=0.0;    <==remove this sand fine


return vSound*Norm(delGunToMix);  

elif  mode=2 then #`reflect off wall at z=0`        

end if;   return 0.0;  end proc:

Error, invalid 'if' statement
==>I can delclare the variable 'local' outside the if. Why? It doesn't make much sense, though not that hard to avoid.

Please Wait...