Illustrates the use of the shortcut operators

image_pdfimage_print

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

Publisher: Sybex;
ISBN: 0782129110
*/

/*
  Example3_7.cs illustrates the use of
  the shortcut operators
*/

public class Example3_7
{

  public static void Main()
  {

    int length = 1;

    length += 10;
    System.Console.WriteLine("length = " + length);

    length *= 2;  // multiplies length by 2
    System.Console.WriteLine("length = " + length);

    length /= 3;  // divides length by 3
    System.Console.WriteLine("length = " + length);

  }

}