Dim whileIndex As Integer = 10
Dim arrNumbers(10) As Integer
Dim whileindex2 As Integer = 1
While arrNumbers(whileIndex) >= whileindex2
whileindex2 = 1
End While
' A WHILE loop to output the contents of an array
While arrNumbers(whileIndex) >= whileindex2
arrNumbers(whileIndex) = arrNumbers(whileIndex) - 1
Console.WriteLine(whileindex2)
End While
While loops and arrays
Page 1 of 13 Replies - 564 Views - Last Post: 17 March 2013 - 12:37 PM
#1
While loops and arrays
Posted 17 March 2013 - 12:10 PM
Please help, I when i run this program, nothing shows. Thanks in advance.
Replies To: While loops and arrays
#2
Re: While loops and arrays
Posted 17 March 2013 - 12:16 PM
Put a breakpoint on line 9.. what is the value of "arrNumbers(whileIndex)"? My guess is zero.. since you created an array but never filled it with anything.. so when is 0 going to be greater or equal to 1?
#3
Re: While loops and arrays
Posted 17 March 2013 - 12:30 PM
Thanks very much, you wouldn't believe how much time I spent trying to figure that out, you can probably tell that I'm a novice but you have to start somewhere I guess...
#4
Re: While loops and arrays
Posted 17 March 2013 - 12:37 PM
I feel your pain. Learning about breakpoints and stepping through code one line at a time is going to save you a whole lot of grief. Well done!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|