Download presentation
Presentation is loading. Please wait.
Published byDelphia Sparks Modified over 8 years ago
1
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com All About The Arrays By Judi Copeland
2
What is an Array Variables are memory pockets It stores information for a program A program can have many variables An array is simply a group of variables An array is a group of variables In a program, this allows data retrieved quickly
3
One Dimensional Array Arrays can be one dimensional These can be thought of as a list In this list, everything belongs to the same group Each item is numbered by subscript starting with 0
4
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com Two-Dimensional Arrays Arrays can also be two-dimensional These can be thought of more of a spreadsheet Similar topics that can be broken down Each topic has its own list Like one-dimensional arrays, they are also numbered starting from 0
5
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com One-Dimensional Format [Dim | Private] arrayName (highest numbersubscript) As datatype That could be replaced with Dim cake (5) As String Private birthdayCandles (10) As Decimal
6
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com Another One-D Example [Dim | Private] arrayName() As Datatype = {initialValues} That could be replaced with Dim cake () As String = {chocolate, vanilla, strawberry, banana, cherry, white} Private birthdayCandles () As Decimal = {1,5,10,12,18,21}
7
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com Two-Dimensional Format Since this version uses more than one group of lists, it differs [Dim | Private] arrayName (highestRowSubscript, highestColumnSubscript) As Datatype This pulls information from all of the columns involved This coordinates it with all the rows below each column
8
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com Example FrostingChocolate cake Vanilla cake Cherry cake Lemon cake chocolate SKU 1SKU 4SKU 7SKU 10 vanilla SKU 2SKU 5SKU 8SKU 11 Cream cheese SKU 3SKU 6SKU 9SKU 12 Cake inventory available – two categories, one for cake and the other for frosting
9
copyright 2008 Judith A Copeland - http://www.webprogramminglounge.com Using That Table in 2-D Dim cakeInventory (3, 2) As String There are 4 flavors of cake The first cake flavor is number 0 The last cake is number 3 There are 3 flavors of frosting The first frosting flavor is 0 The last frosting flavor is 2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.