Skip to content

Instantly share code, notes, and snippets.

@unisys12
Created August 17, 2013 21:06
Show Gist options
  • Save unisys12/6258705 to your computer and use it in GitHub Desktop.
Save unisys12/6258705 to your computer and use it in GitHub Desktop.
Learning C# and working with arrays. Little exercise I did using a for loop to number a list of people.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Arrays
{
class List
{
static void Main(string[] args)
{
/* Using array.length to number a list
* of names from a simple array.
*/
string[] names = { "Bob", "Mary", "Joe", "Sue" };
string msg = "Those coming to the party are ";
Console.WriteLine(msg);
for (int i = 0; i < names.Length; i++)
{
Console.WriteLine( i+1 + ") " + names[i] );
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment