Single-dimensional array declaration
📖 Scenario: You are creating a simple program to store the names of fruits in a list. This list will help you keep track of fruits you want to buy from the market.
🎯 Goal: Build a program that declares a single-dimensional array of fruits, sets a size for it, fills it with fruit names, and then prints all the fruit names.
📋 What You'll Learn
Declare a single-dimensional array of strings called
fruits with size 4Assign the fruit names
"Apple", "Banana", "Cherry", and "Date" to the array elementsUse a
for loop with variable i to iterate over the arrayPrint each fruit name inside the loop using
Console.WriteLine💡 Why This Matters
🌍 Real World
Arrays are used to store lists of items like names, prices, or scores in many programs.
💼 Career
Knowing how to declare and use arrays is a basic skill for software developers working with data collections.
Progress0 / 4 steps