Problem in FOR loop ... Is it a BUG ?! RRS feed

  • Question

  • Hello all ,

    I discovered that error by chance when I was working on Collections. But I found it in FOR loop in VB.Net.

    Have a Look :
    Sub Main()  
            Dim Y As Integer = 10  
            For x As Integer = 0 To Y  
                Y = Y - 1  
    End Sub 
    'and the result was 
    'and that is not logically correct !! 
    'the Correct result should be : 
    'as Y decreased every step. 

    In other words : why FOR loop limit is not updated every step!!!! ? Is it a Bug or What ?!

    thanks in advance !!

    Monday, November 3, 2008 5:35 PM