Hi there-
I am trying to right a Gnome sort in VB.net and it is just not doing what I want it to do. Here is what I have so far:

Dim num() As Integer = {1, 9, 3, 6, 7, 2}
Dim temp As Integer
Dim i As Integer = 0

While (i < 5)
If (i = 0) Then
Debug.WriteLine(num(i))
i = 1
End If

If (num(i - 1) <= num(i)) Then
i = i + 1
Debug.WriteLine(num(i))
Else
num(i - 1) = num(i)
i -= 1
'Debug.WriteLine(num(i))
End If
Debug.WriteLine(num(i))

End While

I am not sure if its working or not. I think the while loop works because it the debug output give 6 values. the problem is the first three digits outputted are three 3's. Please help. Thanks.