Chapter 4. Operators


An operator is a symbol (such as = , + , or > ) that causes C# to take an action. That action might be an assignment of a value to a variable, the addition of two values, a comparison of two values, and so forth.

In the previous chapter, you saw the assignment operator used. The single equals sign ( = ) is used to assign a value to a variable; in this case, the value 15 to the variable myVariable :

 myVariable = 15; 

C# has many different operators that you'll learn about in this chapter. There's a full set of mathematical operators, and a related set of operators just for incrementing and decrementing in integral values by one, which actually are quite useful for controlling loops , as you'll see in Chapter 5. There are also operators available for comparing two values, which are used in the branching statements, as I'll demonstrate in the next chapter.



Learning C# 2005
Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)
ISBN: 0596102097
EAN: 2147483647
Year: 2004
Pages: 250

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