Chapter 5 Quick Reference


Chapter 5 Quick Reference

To

Do this

Add an amount to a variable

Use the compound addition operator. For example:

variable += amount;

Subtract an amount from a variable

Use the compound subtraction operator. For example:

variable -= amount;

Run one or more statements while a condition is true

Use a while statement. For example:

int i = 0;  while (i != 10)  {      Console.WriteLine(i);      i++;  }

Alternatively, use a for statement. For example:

for (int i = 0; i != 10; i++)  {      Console.WriteLine(i);  } 

Repeatedly execute statements one or more times

Use a do statement. For example:

int i = 0;  do  {      Console.WriteLine(i);      i++;  }  while (i != 10);




Microsoft Visual C# 2005 Step by Step
Microsoft® Visual C#® 2005 Step by Step (Step By Step (Microsoft))
ISBN: B002CKYPPM
EAN: N/A
Year: 2005
Pages: 183
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net