C# Scope

This makes no sense to me. 

The situation:

public OutputType functionName(){

MyDataType myVarName; // <-- proper declaration here

foreach (something in something){ 
if (some condition){
myVarName=blah;
}
else{
myVarName=bloop;
}
}
return f(myVarName); // <-- uninitialized local variable error here
}

I get an error that myVarName on the last line is uninitialized. Stepping through shows that the variable is being assigned correctly in the foreach block. 

I read the web and it says that variables are scoped to the block in which they are declared. Since that's exactly what I have, I am very confused.

For no real reason, I try this:

public OutputType functionName(){
MyDataType myVarName;

myVarName=doodle; // <-- frivolous assignment

foreach (something in something){
if (some condition){
myVarName=blah;
}
else{
myVarName=bloop;
}
}
return f(myVarName); // <-- no error
}

And it works fine.

This tells me that local variables are scoped to the block in which they are first assigned

Even thought that specifically contradicts microsoft.com.

Ouch!