4.1. Basic Building Blocks of a Programming Language

While the specific rules of a programming language differ from one language to another, the underlying foundation upon which all programming languages are built is pretty much the same. There is a hierarchy that all languages follow. This hierarchy is:

Programs Statements Expressions Operands and Operators

You can verbalize this hierarchy like this: "Programs consist of one or more statements. Statements consist of one or more expressions. Expressions consist of one or more operands in conjunction with one or more operators." Therefore, to write a program you must understand operands and operators. We begin our journey into the innards of C# by learning about operands and operators.

4.1.1. Operands and Operators

In Chapter 3 you wrote a program that used two variables to store the information that was entered by the user. The program was designed to divide the first number by the second number. Suppose the user typed in 10 for the first number and 6 for the second. You've been doing this kind of math since you were in grade school. We can write the process of dividing 10 by 6 as:

10 / 6

This simple math process involves taking ...

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.