Visual Basic double array declaration and initialisation

earth man2
earth man2 used Ask the Experts™
I am simple FORTRAN programmer I am trying to create and initialize a simple double array.

How do I acheive the following ?

Visual Basic finds problem a equals sign saying "Expected end of Statement"
Dim yy2() As Double = { 1.5, 2.3, 4.4 }

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Rajkumar GsSoftware Engineer

Go through this link to get an clear Idea

Nice link, tho it doesn't explain why that dim statement is wrong.
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
That is newer syntax that would work in VB.Net.

For older versions you could do:

    Dim yy2 As Variant
    yy2 = Array(1.5, 2.3, 4.4)
    Dim i As Integer
    For i = 0 To UBound(yy2)
        Debug.Print i & ": " & yy2(i)
Thx idle.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial