# Standard Pascal expressions

**The order of calculations in expressions is as follows:**

- Subexpressions are calculated (in parentheses);
- Next, operations with the highest priority are performed. The following priority levels are most commonly used (descending):

o exponentiation;

o * , / , div , mod — multiplicative operations;

o + , — , abs , not — unary operations;

o +, -; – additive operations;

o = ,<>, <, >, <=, >= — relationship operations;

o and, or, not — logical operations; - Operations that have the same priority are performed from left to right.

Although there are no restrictions on the complexity of expressions, expressions that consist of more than seven operands are difficult to understand and read. They are not advised to use.

In Pascal, there is no standard function or exponentiation operation, respectively, such a mathematical identity is used: **xy= eylnx**. In Pascal, only the standard function for calculating the natural logarithm is used, so the mathematical identity is used: logab= ln b/ln a.

Mathematical expression:

**exp(3*ln(x)/2)-7*x+sin(x+2)/cos(x+2)**

## Action Operators

Action operators are language tools that allow you to change the state of calculations during program execution. The most elementary action operator is the assignment operator.

<name_variable>:=<expression>

**Example**

a:=15+5; {variable a assignable to a mathematical expression. It is important that the variable a is of numeric type}

Despite its apparent simplicity, the assignment operator has an important algorithmic value.

Assigning a variable to a specific value means placing that value in the variable's box. In addition, each storage box has the following properties:

- A mailbox (at any given time) cannot store more than one value.
- Each mailbox can only store a value of the same type. Otherwise, an error will occur in the program.
- The value in the mailbox will be stored until a new job is placed in the mailbox. Moreover, the previous content will be lost irretrievably.
- The value in the mailbox is considered the current value of the corresponding variable. It can be issued from the box as many times as you like, but the contents are unchanged: a copy of the value is issued from the box each time and the original is preserved without any changes.
- The contents of all storage boxes are considered undefined at the beginning of the program execution. They can not be considered empty, since these boxes can be used when executing past programs, after which something could be saved.

It is worth considering the empty operator, which is indicated in Pascal by the sign ";". It doesn't do anything. Also in Pascal, the operator of the action is the operator of the procedure. The last of the simplest action statements is the stop statement, which interrupts the program (in Pascal, this is the halt operator).

## Data input and output

Keyboard input is performed using the standard read procedure (<the list of input>) or its variety readln (<the list of input>). Input list items—variable names(IDs) that are listed separated by commas. When performing this statement, the user types the necessary sequence of values on the keyboard, separating them with spaces.

**Example:**

read(a,b,c); {wherea,b,c are variables. data entry is performed through a space}

readln(a,b,c); {wherea,b,c are variables. data entry is performed through enter(return of proofreading)}

Data is displayed on the screen using the standard procedure write (<fall lists>) or its variety writeln (<fall list>). The output list can contain variables, expressions, constants, output format. Expressions in lists should be separated by commas.

**Example:**

write(a,b,c); {wherea,b,c are variables. after the data is displayed, the cursor is on the last character}

writeln(a,b,c); {wherea,b,c are variables. after the data is displayed on the screen, the cursor moves to a new line)}

Ending ln in the name of the procedure indicates that the cursor will be moved to the beginning of the next line of the screen.