How to show output of a string type array by using For Each Loop in VB.NET
In this article you will learn the usage of For Each Loop
Whenever you face a situation in programming to repeat a task for several times (more than one times ) or you have to repeat a task till you reach a condition, in these situations you can use loop statements to achieve your desired results.
FOR EACH Loop usually using when you are in a situation to execute every single element or item in a group (like every single element in an Array, or every single files in a folder or , every character in a String ) , in these type of situation you can use For Each loop.
EXAMPLE
Public Class health
Public Shared Sub Main()
Dim fruit() As String = {"Oranges", "Apples", "mango", "banana"}
For Each types As String In fruit
Console.WriteLine(types)
Next types
Console.ReadLine()
End Sub
End Class
OUTPUT
