Put arrays into practice with the Swift programming language. Learn how to declare, create, and initialize arrays so that you can take advantage of them in your own programming language.
- [Instructor] We've talked about arrays in theory,…but now it's time to put them into practice…in a programming language, Swift.…Let's say we wanted to compute the average number of pets…each student has in a class.…This calls for a data structure…because we would need a way to store and access…each student's individual number of pets,…as well as a way to compute the average.…We are using JDoodle for writing code in this course.…It's an online editor and compiler…that lets us write programs in various languages.…
So let's start by selecting Swift…as our programming language.…We have our problem statement…and the first thing we need to do…is create an array of numbers.…So we'll delete this code,…and each number in this array will represent…the number of pets a specific student has,…so I'll write var per student pet count…and put a series of values in here that will represent…the number of pets each specific student has.…Here, we've created and initialized an array with values.…
In order to compute the average number of pets…
- Data types: Booleans, numbers, strings, and more
- Multidimensional arrays
- Jagged arrays
- Search and sort arrays
- Linked lists
- Stacks and queues
- Hash functions and hash tables
- Trees and graphs
Skill Level Intermediate
Understand data structures1m 25s
1. Introduction to Data Structures
4. Stacks and Queues
5. Hash-Based Data Structures
6. Trees and Graphs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.