0% found this document useful (0 votes)
12 views1 page

Expressions

Expressions evaluate to a value and can be combined using operators to form more complex expressions. The simplest expressions are variables, literals, and function calls. Expressions appear on the right side of assignments, in function calls, and in statements. More complex expressions are built by combining simpler expressions with comparison, arithmetic, and logical operators. An expression is not the same as its value - the process of evaluation determines an expression's value.

Uploaded by

ravg10
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Expressions

Expressions evaluate to a value and can be combined using operators to form more complex expressions. The simplest expressions are variables, literals, and function calls. Expressions appear on the right side of assignments, in function calls, and in statements. More complex expressions are built by combining simpler expressions with comparison, arithmetic, and logical operators. An expression is not the same as its value - the process of evaluation determines an expression's value.

Uploaded by

ravg10
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Expressions

By:Gap

An expression is a construct that evaluates to a value. Syntactic constructs that are executed to
produce a side effect and return no value are called statements(see Statements). Expressions appear
as right hand sides of assignments (see Assignments), as actual arguments in function calls
(see Function Calls), and in statements.
Note that an expression is not the same as a value. For example 1 + 11 is an expression, whose
value is the integer 12. The external representation of this integer is the character sequence 12, i.e.,
this sequence is output if the integer is printed. This sequence is another expression whose value is
the integer 12. The process of finding the value of an expression is done by the interpreter and is
called the evaluation of the expression.
Variables, function calls, and integer, permutation, string, function, list, and record literals
(see Variables, Function Calls, Integers, Permutations, Strings and
Characters, Functions, Lists, Records), are the simplest cases of expressions.
Expressions, for example the simple expressions mentioned above, can be combined with the
operators to form more complex expressions. Of course those expressions can then be combined
further with the operators to form even more complex expressions. The operators fall into three
classes. The comparisons are =,<>, <, <=, >, >=, and in (see Comparisons and Membership Test for
Collections). The arithmetic operators are +, -, *, /, mod, and ^ (see Arithmetic Operators).
The logical operators are not, and, and or (see Operations for Booleans).
The following example shows a very simple expression with value 4 and a more complex
expression.
gap> 2 * 2;
4
gap> 2 * 2 + 9 = Fibonacci(7) and Fibonacci(13) in Primes;
true

Reference : http://www.gap-system.org/Manuals//doc/htm/ref/CHAP004.htm#SECT007
Date:17-9-2008

You might also like