SlideShare uma empresa Scribd logo
1 de 14
ARRAYS
A WHOLE HEAP OF BUCKETS
One Variable Can Only Hold One
               Thing



I’m holding
 the name
   DAVE
               Name
One Variable Can Only Hold One
               Thing


                          DON’T TRY
I’m holding                AND PUT
 the name                 ANOTHER
   DAVE                    NAME IN
               Name          ME!
An Array is Different kind of Variable

I’m holding   I’m holding   I’m holding
 the name      the name      the name
   DAVE          ADAM          CLEM



      0             1           2

                Name
An Array is Different kind of Variable
An array is a set of values that are logically related to each other,
    such as the number of students in each grade in a grammar
                                school.




           0                      1                     2

                            Name
An Array is Different kind of Variable

An array is like many buckets stuck together




      0              1              2

                 Name
An Array is Different kind of Variable
     An Array has many compartments to hold data

The array below has 3 compartments. It can hold 3 pieces
                        of data




       0                   1                   2

                      Name
An Array is Different
               Each compartment is labelled

                The labelling starts from 0


Index 0             Index 1             Index 2




          0                   1                   2

                        Name
An Array is Different
  You can access different parts of the array by referencing
                 the correct index number



Index 0              Index 1             Index 2




          0                    1                   2

                         Name
Arrays In VB
                                       Declaring the
  Declaring the     Declaring the     data type of the
     Array        size of the Array    Array, in this
                                       case a String




 Dim names(3) As String
                names(0) = "DAVE"
 Declaring the
contents of the names(1) = "ADAM"
    Array
                names(2) = "CLEM"
Arrays In VB
Dim names(3) As String

       names(0) = "DAVE"
       names(1) = "ADAM"
       names(2) = "CLEM"



  Console.WriteLine(names(0))
  Console.WriteLine(names(1))
  Console.WriteLine(names(2))
                                    Writing the
                                  contents of the
  Console.ReadLine()
                                    array to the
                                      console.
Arrays In VB
Dim names(3) As String

       names(0) = "DAVE"
       names(1) = "ADAM"
       names(2) = "CLEM"


     Console.WriteLine(names(0))
     Console.WriteLine(names(1))
     Console.WriteLine(names(2))

       Console.ReadLine()
                                     Erasing the
                                   contents of the
Erase names
                                        Array
Arrays and WHILE
Module Module1
                                    The while loop will
   Sub Main()                          look at every
       Dim names(3) As String
                                     compartment of
       names(0) = "DAVE"             the names array
       names(1) = "ADAM"
       names(2) = "CLEM"

       Dim i As Integer = 0


       While i < names.Length - 1

           Console.WriteLine(names(i))
           i = i + 1
       End While

       Console.ReadLine()

   End Sub
Arrays and WHILE
Module Module1

   Sub Main()
       Dim names(3) As String

       names(0) = "DAVE"
       names(1) = "ADAM"
       names(2) = "CLEM"

       Dim i As Integer = 0


       While i < names.Length

           Console.WriteLine(names(i))
           i = i + 1
       End While

       Console.ReadLine()

   End Sub

Mais conteúdo relacionado

Destaque

Sf Group Presentation
Sf Group PresentationSf Group Presentation
Sf Group Presentationlchetwynd
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheralregianza
 
особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...punkoff34
 
Психологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому станіПсихологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому станіpunkoff34
 
Master SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis onlineMaster SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis onlineXavi Marcé Vila
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheralregianza
 
комп`ютерна залежність
комп`ютерна залежністькомп`ютерна залежність
комп`ютерна залежністьpunkoff34
 

Destaque (15)

Sf Group Presentation
Sf Group PresentationSf Group Presentation
Sf Group Presentation
 
If
IfIf
If
 
Select case
Select caseSelect case
Select case
 
Presentaci n1 (1)
Presentaci n1 (1)Presentaci n1 (1)
Presentaci n1 (1)
 
Reading in files
Reading in filesReading in files
Reading in files
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheral
 
Savonuk
SavonukSavonuk
Savonuk
 
особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...особливості реалізації основних положень концепції розвитку психологічної слу...
особливості реалізації основних положень концепції розвитку психологічної слу...
 
Психологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому станіПсихологічна допомога дітям у кризовому стані
Психологічна допомога дітям у кризовому стані
 
Master SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis onlineMaster SmmUS 2015/2016 - Gestión de comunidades y crisis online
Master SmmUS 2015/2016 - Gestión de comunidades y crisis online
 
Syntax errors
Syntax errorsSyntax errors
Syntax errors
 
C# Arrays
C# ArraysC# Arrays
C# Arrays
 
Melakukan perbaikan peripheral
Melakukan perbaikan peripheralMelakukan perbaikan peripheral
Melakukan perbaikan peripheral
 
комп`ютерна залежність
комп`ютерна залежністькомп`ютерна залежність
комп`ютерна залежність
 
Arrays C#
Arrays C#Arrays C#
Arrays C#
 

Mais de Peter Andrews

Mais de Peter Andrews (8)

Trimming text
Trimming textTrimming text
Trimming text
 
Splitting up text
Splitting up textSplitting up text
Splitting up text
 
Is numeric
Is numericIs numeric
Is numeric
 
Loops
LoopsLoops
Loops
 
Collecting user input
Collecting user inputCollecting user input
Collecting user input
 
Variables
VariablesVariables
Variables
 
Hello world
Hello worldHello world
Hello world
 
Flow charts
Flow chartsFlow charts
Flow charts
 

Último

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 

Último (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Arrays

  • 1. ARRAYS A WHOLE HEAP OF BUCKETS
  • 2. One Variable Can Only Hold One Thing I’m holding the name DAVE Name
  • 3. One Variable Can Only Hold One Thing DON’T TRY I’m holding AND PUT the name ANOTHER DAVE NAME IN Name ME!
  • 4. An Array is Different kind of Variable I’m holding I’m holding I’m holding the name the name the name DAVE ADAM CLEM 0 1 2 Name
  • 5. An Array is Different kind of Variable An array is a set of values that are logically related to each other, such as the number of students in each grade in a grammar school. 0 1 2 Name
  • 6. An Array is Different kind of Variable An array is like many buckets stuck together 0 1 2 Name
  • 7. An Array is Different kind of Variable An Array has many compartments to hold data The array below has 3 compartments. It can hold 3 pieces of data 0 1 2 Name
  • 8. An Array is Different Each compartment is labelled The labelling starts from 0 Index 0 Index 1 Index 2 0 1 2 Name
  • 9. An Array is Different You can access different parts of the array by referencing the correct index number Index 0 Index 1 Index 2 0 1 2 Name
  • 10. Arrays In VB Declaring the Declaring the Declaring the data type of the Array size of the Array Array, in this case a String Dim names(3) As String names(0) = "DAVE" Declaring the contents of the names(1) = "ADAM" Array names(2) = "CLEM"
  • 11. Arrays In VB Dim names(3) As String names(0) = "DAVE" names(1) = "ADAM" names(2) = "CLEM" Console.WriteLine(names(0)) Console.WriteLine(names(1)) Console.WriteLine(names(2)) Writing the contents of the Console.ReadLine() array to the console.
  • 12. Arrays In VB Dim names(3) As String names(0) = "DAVE" names(1) = "ADAM" names(2) = "CLEM" Console.WriteLine(names(0)) Console.WriteLine(names(1)) Console.WriteLine(names(2)) Console.ReadLine() Erasing the contents of the Erase names Array
  • 13. Arrays and WHILE Module Module1 The while loop will Sub Main() look at every Dim names(3) As String compartment of names(0) = "DAVE" the names array names(1) = "ADAM" names(2) = "CLEM" Dim i As Integer = 0 While i < names.Length - 1 Console.WriteLine(names(i)) i = i + 1 End While Console.ReadLine() End Sub
  • 14. Arrays and WHILE Module Module1 Sub Main() Dim names(3) As String names(0) = "DAVE" names(1) = "ADAM" names(2) = "CLEM" Dim i As Integer = 0 While i < names.Length Console.WriteLine(names(i)) i = i + 1 End While Console.ReadLine() End Sub