Ask a Teacher



what is an expression? and what will be the output of this expression: pq+rs/rs

An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces (returns, in a stateful environment) another value. This process, like for mathematical expressions, is called evaluation. The value can be of various types, such as numerical, string, and logical.

For example, 5 + 2 is an arithmetic and programming expression which evaluates to 7. A variable is an expression because it denotes a value in memory, so y + 6 is an expression. An example of a relational expression is 4 ? 4, which evaluates to false.


comments powered by Disqus