Expressions and Operators

December 12, 2014    C# .Net Coding Programming

As I progress with this language, I am struck with how much more can be accomplished with its IDEs as opposed to how Eclipse functioned with Java.

I continue to enjoy the concept of programming. Being able to manipulate how a machine is functioning is a pretty cool feeling. Additionally, I like that I can leave a project that I am having a hard time with or getting frustrated with and come back later and nothing has changed.

I have been going through expressions and operators. I am understanding that expressions refer to several different components. The literal value, simple name, operators and operands and method invocation. I am not sure What some of those things mean, but in time I am sure I will.

Literal values and the Simple names are a pretty straightforward concept. I found it the most useful to think of the simple name as the name of the memory that is reserved and the literal value as the value that is being stored in that memory.

Operators are equally straightforward. They are essentially the modifiers in an operands (expression parts). Things like =, +, -, new, <, >, *, /, ect, are operators that modify an operand. In “x == y,” “x” and “y” are the operators and == is the operand. One thing that I found interesting is that “=” designates assignment and “==” designates that two operands are equal.

The thing that I found most interesting is the concept of associativity. This basically means that an expression is evaluated in a particular way. In the examples I gave above, x == y, is read as “the value of x is equal to the value of y.” However, the computer reads it as “the value of x and the value of y are equal” or “x, y, ==.” A further example of this is where x = 2, y = 3, and z = 4 and 2 + 3 * 4 = 14. This is because multiplicative operators takes priority over the additive operators. Using parentheses can switch the precedence of these operators. So, (2 + 3) * 4 = 20. I found this concept fascinating.

I am looking forward to learning more. I have seen that if and else statements and loops are coming up. I am looking forward to using them and beginning to actually start making small programs.