## `_stmtseq` -- statement sequences

#### Introduction

The function call `_stmtseq(`object1, object2...`)` is equivalent to the statement sequence `(object1; object2; ...)`.

#### Call(s)

`(object1; object2; ...)`
`(object1: object2: ...)` `_stmtseq(object1, object2, ...)`

#### Parameters

`object1, object2, ...` | - | arbitrary MuPAD objects and statements

#### Returns

the return value of the last statement in the sequence.

#### Related Functions

`_exprseq`

#### Details

- The function call `_stmtseq(`object1, object2...`)` evaluates the statements `(object1; object2; ...)` from left to right.
- `_stmtseq(``)` returns the void object of type `DOM_NULL`.
- `_stmtseq` is a function of the system kernel.

#### Example 1

Usually, statements are entered imperatively:

    >> x := 2; x := x^2 + 17; sin(x + 1)

                                         2

                                        21

                                      sin(22)

This sequence of statements is turned into a single command (a ``statement sequence'') by enclosing it in brackets. Now, only the result of the ``statement sequence'' is printed. It is the result of the last statement inside the sequence:

    >> (x := 2; x := x^2 + 17; sin(x + 1))

                                      sin(22)

Alternatively, the statement sequence can be entered via `_stmtseq`. For syntactical reasons, the assignments have to be enclosed in brackets when using them as arguments for `_stmtseq`. Only the return value of the statement sequence (the return value of the last statement) is printed:

    >> _stmtseq((x := 2), (x := x^2 + 17),  sin(x + 1))

                                      sin(22)

Statement sequences can be iterated:

    >> x := 1: (x := x + 1; x := x^2; print(i, x)) $ i = 1..4

                                       1, 4

                                       2, 25

                                      3, 676

                                     4, 458329

    >> delete x:

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000