I just made an interesting mistake in my code:
Dim endColumn As Integer = startColumn + endColumn - 1
The code was actually supposed to be:
Dim endColumn As Integer = startColumn + numColumns - 1
The interesting thing is, I would think that this code should be recursive and loop indefinitely, as the initialization of endColumn sort of calls itself. However, it seems that the code just treats the uninitialized variable as a 0 and so I get startColumn + 0 - 1
. What is happening here behind the scenes? When does a variable get assigned a default value?