Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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.