50 likes | 136 Views
ME 142 Engineering Computation I. Arrays. Key Concepts. Array Basics 1-Dimensional Arrays. Array Basics. Variable that stores multiple data values under a single name Individual data values within the array are accessed by an index or subscript within a loop. Array Syntax.
E N D
Key Concepts Array Basics 1-Dimensional Arrays
Array Basics • Variable that stores multiple data values under a single name • Individual data values within the array are accessed by an index or subscript within a loop
Array Syntax Dim ArrayName(size) Dim ArrayName(LowerIndex to UpperIndex) Dim ArrayName(size) as Double Dim ArrayName(size1, size2)
1- Dimensional Array Example Sub demo() Dim A(1 To 5) For i = 1 To 5 A(i) = InputBox("Enter number:") Next I Total = 0 For i = 1 To 5 Total = Total + A(i) Next I MsgBox "Total = " & Total End Sub