How in ASP when defining an array to immediately set its values? Some manuals describe how

Dim a()={1,2,3} 

but it fails (causes an error).

    2 answers 2

    Perhaps you need to write like this -

     Dim a() as integer = {1,2,3} 
    • in continuation of the above, and warning the question is still further)) <pre> Dim b (,) As String = {{aa "," ab "}, {" ba "," bb "}} </ pre> for two - dimensional - Grimon
    • one
      Read more here: " A Practical Guide. Initializing Array Variables in Visual Basic ." I do not think that there is any specificity in working with arrays in ASP.NET. - stanislav
    • Thank you, but HTTP 500.100 - Internal server error - ASP error Internet Information Services Error type: Microsoft VBScript compilation error (0x800A0401) The instruction completion is expected /abit.html, line 10, column 8 Dim a () as integer = {1,2 , 3} ------- ^ A constant of the integer type is assumed /abit.html, line 12, column 6 Dim b (,) As String = {{"??", "??"}, {"? ? "," ?? "}} ----- ^ - Andry
    • And so Dim numbers = New Integer () {1, 2, 4, 8}? - stanislav
    • so also tried. not. It categorically does not accept the sign = I note that this is ASP and not ASP.NET. And this is VBScript, not Visual Basic - Andry

    In Classic ASP (VBScript) is done like this:

     Dim arr arr = Array(1, 4, 19) 

    In ASP.NET (VB.NET) it is done like this:

     Dim arr as int32() = {1, 6, 10}