O'Reilly logo

Special Edition Using® Microsoft® ASP.NET by Richard Leinecker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Expressions

Expressions are statements that, when executed, result in a value. When programming, you use expressions all the time, sometimes without even realizing it. The following are examples of expressions:

VB

65 + 5 ' Produces a value of 70. 
( i < 10 ) ' Produces a true or false. 

C#

5 * 100 // Produces a value of 500 
x = 25 - 5 // Subtracts 5 from 25 then stores in x 

JScript

175 - 4 // Produces 171 
15 / 3 // Produces 5 

Expressions typically are composed of several smaller expressions, or subexpressions, connected by operators. For instance, consider the following lines of C# code:

int x = 100, y; 
y = ( x / 4 ) + 3; 

The first line of code, where the variables are declared, actually contains an expression in the assignment of 100 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required