Friday, 3 February 2017

VB.net Array

Array is a collection of similar data type which occupies continuous location on memory.

Dim ar(4) As Integer
        For i = 0 To 4
            Console.Write("Enter {0} 'st number>> ", i + 1)
            ar(i) = Val(Console.ReadLine())
        Next
        For i = 0 To 4
            Console.Write(" {0},", ar(i))

        Next
        'array without size specification
        Dim fruit() = {"apple", "Mango", "Banana"}
        For Each f As String In fruit
            Console.WriteLine(f)

No comments:

Post a Comment