Partager via


The longest introduction to C#

Today, I suddenly found my first book about C#. Here is the first C# program from there:

 using System;
class Hello
{
 public static void Main(string []args)
 {
 if (args.Length==0)
 {
 Console.WriteLine("Hello, World");
 }
 else
 {
 Console.WriteLine("Hello, " + args[0]);
 }
 }
}
 

And here is the first one that we developed with Dmitriy Nikonov in our first module about C#:

 using static System.Console;
 
class Program
{
 static void Main(string[] args)
 {
 WriteLine((args.Length==0) ? "Hello" : $"Hello {args[0]}");
 }
}

Try to find any difference.

The first module is here.

Comments

  • Anonymous
    February 08, 2016
    Found a difference. Second program is missing the comma. :')