2005-03-23 Ritvik Mayank <mritvik@novell.com>
[mono.git] / mcs / mbas / Test / tests / LocalDeclarationA.vb
1 Imports System
2
3 Module LocalDeclarationA
4
5     Sub main()
6         Dim i, sum As Integer
7         For i = 0 To 4
8             sum = sum + f2()
9         Next
10         If sum <> 15 Then
11             Throw New Exception("#LD1: Static locals error")
12         End If
13     End Sub
14
15     Sub f1()
16
17         ' Various kinds of local decalations statements
18         Const a1 As Integer = 2
19         Static a2 As Double
20         Dim a3 As Integer ' Default value is initialized to 0 
21         Dim a4 As Boolean = True
22         Dim arr1() As Integer = {0, 1, 2, 3}
23         Dim arr2(,) As Integer = {{1, 2, 3}, {1 + 1, 1 + 2, 1 + 3}}
24         Dim arr3(10) As Integer ' An array of 11 integers indexed from 0 through 10
25         Dim arr4(2, 3, 4) As Date
26         Dim arr5() As Object
27         Dim b1, b2, b3, b4 As Integer
28         Dim c1 As Double, c2 As Boolean, c3 As DateTime
29         Dim d1 As New Date(2004, 8, 11)
30
31     End Sub
32
33     Function f2() As Integer
34         Static a As Integer
35         a = a + 1
36         Return a
37     End Function
38
39 End Module