An expression is a combination of one or more constants, variables, operators, and functions that the programming language interprets (according to its particular rules of precedence and of association) and computes to produce ("to return", in a stateful environment) another value. This process, as for mathematical expressions, is called evaluation.
In simple settings, the resulting value is usually one of various primitive types, such as numerical, string, logical, complex data type or many others.
For example, 2+3
is an arithmetic and programming expression which evaluates to 5
. 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
.
- What is an expression? Explain what an expression is and how it is different from a statement.
This exercise deals with cooking a lasagna dish in the oven. The reference implementation (Common Lisp) teaches:
- What an expression is.
Track | Exercise | Changes |
---|---|---|
Common Lisp | basics |