C# - An Introduction - C# Statements
(Page 4 of 9 )
A C# statement is the same as a complete sentence in the English language. This is the best and simplest analogy that illustrates what a statement is. Look at the following example:
I like Microsoft products.
Anyone reading this sentence will understand that I like Microsoft products. However, if I write it like this:
I like.
What do you like? This is what you may ask because it’s not a complete sentence. The same thing goes with a C# statement. It forms a complete instruction that the C# compiler can understand. So the next statement adds two numbers and stores the value into memory.
memory = 2 + 5;
Note that C# statements end with the semicolon “;”, whereas English sentences end with a full stop “.” In this last C# statement we told the compiler to put the result of adding these two numbers into memory. Don’t worry about understanding the code right now; that will be covered later on.
You must know that C# programs consist of sequences of C# statements that execute in ascending order like the following example:
{
statement 1
statement 2
statement 3
}
The first statement (statement 1) will execute first, then statement2 and end up with the last one (statement 3) being executed.
Next: C# Building-Blocks >>
More C# Articles
More By Michael Youssef