Difference between statement and expression In programming language terminology, an “expression” is a combination of values and functions that are combined and interpreted by the compiler to create a new value, as opposed to a “statement” which is just a standalone unit of execution and doesn’t return anything. C# Expressions An expression in C# is a combination of operands (variables, literals, method calls) and operators that can be evaluated to a single value. To be precise, an expression must have at least one operand but may not have any operator. Let's look at the example below: float price; price = 42.05; Here, 42.05 is an expression. Also, price = 42.05 is an expression too. int x, y, z, sum; sum = x + y + z; Here, x + y + z is an expression. if (age>=18 && age<58) Console.WriteLine("Eligible to work"); Here, (age>=18 && age<58) is an expression that returns a...
Csharp Naija is a blog that teaches C# programming using a practical guide. C# Nigeria is here to guide interested individual to the world of software Engineering.