1. Display series of numbers (1,2,3,4, 5....etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key).
static void Main( string[ ] args )
for ( int i = 0; ; i++ )
if ( Console.KeyAvailable && keyPressHandler( Console.ReadKey( true ) ) ) break;
Console.Write( i + " " );
Thread.Sleep( 250 );
protected static Boolean keyPressHandler( ConsoleKeyInfo input )
if ( input.Key == ConsoleKey.Escape ) return true;
So I saw this page which gives a list of 15 Exercises for Learning a new Programming Language. I thought, this could also be a good way to compare different languages. In that spirit I'm going to do just that and try to complete the list in different popular languages. To start with I will do them in C# and Java.
As it turns out I'm much less familiar with C# than Java so it will also be a learning experience as the original article had intended. You can see the progress in Programming.