expn | expression |
Syntax | An expn is one of:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description | An expression (expn) returns a value; in the general case, this may involve a calculation, such as addition, as in the expression:
3 + width | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example |
put "Hello world" % "Hello world" is an expn var diameter : real const pi := 3.14159 % 3.14159 is an expn diameter := pi * r ** 2 % pi * r ** 2 is an expn var x := diameter % diameter is an expn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Details | In the simplest case, an expression (expn) is simply an explicit constant such as 25 or "Hello world". A variable by itself is considered to be an expression when its value is used. This is the case above, where the value of diameter is used to initialize x. More generally, an expression contains an operator such as + and carries out an actual calculation. An expression may also be a substring, function call, set constructor or enumerated value. For details, see the descriptions of these items. The Turing infix operators are: +, -, *, /, div, mod, **, <, >, =, <=, >=, not=, not, and, or, =>, in, not in, shr (shift right), shl (shift left), and xor (exclusive or). For details, see infixOperator. The Turing prefix operators are +, - and not, ^ (pointer following) and # (see cheat). For details see prefix operator.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also | precedence of operators, as well as the int, real, string and boolean types.
|