Created
August 17, 2013 21:06
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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