In the previous blogs we discussed about For loop and examples using it. Now we will see how to skip numbers to generate Odd number in for Loop.
Module Example13
Sub main()
Dim i As Integer
For i = 1 To 25 Step 2
Console.WriteLine(i)
Next
Console.ReadKey()
End Sub
End Module
The above example shows how to generate Odd numbers just by adding Step keyword with For loop.
Next we will see another example to generate numbers in descending order.
Module Example14
Sub main()
Dim i As Integer
For i = 25 To 1 Step -1
Console.WriteLine(i)
Next
Console.ReadKey()
End Sub
End Module