Locked lesson.
About this lesson
We explore how to update an existing Array by changing one of its values.
Exercise files
Download this lesson’s related exercise files.
24 - Updating Arrays.docx61.1 KB 24 - Updating Arrays SOLUTION.docx
58.1 KB
Quick reference
Updating Arrays
Arrays can be updated whenever you like.
When to use
Do this whenever you need to update an array.
Instructions
string[] toppings = new string[3] {"Pepperoni", "Mushroom", "Onion"};
toppings[2] = "Cheese"; \\ this replaces the last item in the array 'Onion' with 'Cheese'
Hints & tips
- You can update any item of your array at any time.
- Just assign something else to a specific index number.
Lesson notes are only available for subscribers.