expression: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: expression
| Old | New | Line | |
|---|---|---|---|
| 1 | + | An **expression** is a non-productive rule that resolves by calculation into a value. They consist of at least one operand, and additional operands may be linked via non-unary [[Operator|operators]]. An operand may be | |
| 2 | + | ||
| 3 | + | - a literal value of any type, | |
| 4 | + | - a [[Variable|variable]] or [[Constant|constant]] referred to by its [[Identifier|identifier]], or | |
| 5 | + | - a [[Function|function]] call. | |
| 6 | + | ||
| 7 | + | Examples of expressions are: | |
| 8 | + | ||
| 9 | + | - `x + 5` | |
| 10 | + | - `'Z'` | |
| 11 | + | - `response` [[Not equal|<>]] `42` | |
| 12 | + | ||
| 13 | + | Expressions, and parts thereof, can be classified by their result type. Usually primarily arithmetic and logic expressions are distinguished. An arithmetic expression results in a numeric value. A logic expression results in a [[Boolean|Boolean value]]. | |
| 14 | + | ||
| 15 | + | ## remarks | |
| 16 | + | ||
| 17 | + | With [[Compiler directive|compiler directive]] [[$extendedSyntax|{$extendedSyntax on}]] a function call as an expression can appear as a [[statement]], too. This is useful if the function triggers side-effects, but the return value is not needed. | |
| 18 | + | ||
| 19 | + | ## see also | |
| 20 | + | ||
| 21 | + | - [article „expression“](https://en.wikipedia.org/wiki/Expression_(computer_science)) in Wikipedia, the free online encyclopedia | |
| 22 | + | - Tutorial: [[Boolean Expressions|Boolean expressions]] | |
| 23 | + | - Tutorial: [[How To Use TFPExpressionParser|How to use tFPExpressionParser]] (if an expression entered by the user shall be interpreted) | |
| 24 | + | ||
| 25 | + | --- | |
| 26 | + | *From the Free Pascal wiki, page "expression", as it stood on 2023-01-25 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
