Visual Basic Reverse Array

In the Visual Basic programming language, we use the Array.Reverse() function to reverse the array, or in other words, to sort the elements in reverse order.

In the example code below, first the correct order of the array and then the reverse order are printed on the screen.

Module ModuleTest Sub Main() Dim arr As String() = {"Ali", "Jack", "Joe", "Jennifer", "Mick"} For Each value As String In arr Console.WriteLine(value) Next Console.WriteLine() Console.WriteLine("Print Reverse") Console.WriteLine() Array.Reverse(arr) For Each value As String In arr Console.WriteLine(value) Next Console.WriteLine() Console.ReadLine() End Sub End Module


You May Interest

Visual Basic How To Find The Average Of 10 Numbers Using A While ...

Visual Basic String Using StartsWith

Visual Basic Finding the Computer Name

Visual Basic Finding the Operating System Username

Visual Basic Substring Method