using System;
public class Arrays
{
public static void Main()
/*
array declaration syntax:
'<type>[] a = new <type>[<size>];'
for the 'names' array, '<type>' is 'string', and '<size>' is 5
*/
string[] names = new string[5];
names[0] = "Vitruvius";
names[1] = "Alberti";
names[2] = "Brunelleschi";
names[3] = "Palladio";
// alternative: declaration and initialization in one line
// string[] names = {"Vitruvius", "Alberti", "Brunelleschi", "Palladio"};
'for' loop syntax:
'for (<initializer>; <condition>; <iterator>)'
'int i = 0' declares and initializes variable i (<initializer>)
'i < names.Length' condition is evaluated at each iteration (<condition>)
if condition evaluates to 'true', then continue
if condition evaluates to 'false', then quit loop
'i++' increments i at the end of the 'for' loop block (<iterator>)
'Length' is a field of array (the 'Length' of 'names' is 4)
for (int i = 0; i < names.Length; i++)
Console.WriteLine(names[i]);
}