Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. C# Language, Part 2: Transitive Verbs > Expressions vs. Equations

Expressions vs. Equations

Many C# expressions look just like mathematical equations: They have an operand on either side of an operator, and the operators look like the ones you used for arithmetic. But it’s important to keep sight of the fact that C# expressions are NOT mathematical equations.

5 Expressions don’t always have two operands, although they always have at least one:

image

5 Operators don’t always look like mathematical symbols. Some of them are words, and the most important of these, new, you’ve already used:

image

5 Operands aren’t always numeric values, even when the operators look like arithmetic:

image

Put on Your Thinking Hat

image

Let’s get our feet wet with literal expressions by writing some simple mathematical equations. The operators used to create mathematical formulas in C# are shown in the table. Translate each description into a statement that contains a literal expression.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint