While structure : While « Statements « VB.Net Tutorial






Module Tester
    Sub Main()
        Dim product As Integer = 2


        While product <= 1000
            Console.Write("{0}  ", product)
            product = product * 2
        End While

        Console.WriteLine("Smallest power of 2 " & _
           "greater than 1000 is {0}", product)
    End Sub ' Main

End Module
2  4  8  16  32  64  128  256  512  Smallest power of 2 greater than 1000 is 1024








4.8.While
4.8.1.While structure
4.8.2.Using counter-controlled repetition
4.8.3.Draw square of * by using nested while loop
4.8.4.Combine While and If to search in an array