Init variable

image_pdfimage_print

   

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example2_5.cs is the same as Example2_4.csc, except
  myValue is assigned a value before it is referenced
*/

public class Example2_5
{

  public static void Main()
  {

    int myValue = 2;
    System.Console.WriteLine(myValue);  // no error

  }

}