## `end` -- close a block statement

#### Introduction

`end` is a keyword which, depending on the context, is parsed as one of the following keywords:

- `end_case`
- `end_for`
- `end_if`
- `end_proc`
- `end_repeat`
- `end_while`

#### Related Functions

`end_case`, `end_for`, `end_if`, `end_proc`, `end_repeat`, `end_while`

#### Example 1

Each of the keywords `proc`, `case`, `if`, `for`, `repeat`, and `while` starts some block construct in the MuPAD language. Each block can be closed with `end` or with the corresponding special keyword `end_proc`, `end_case` etc.:

    >> f :=
       proc(a, b)
         local i;
       begin
         for i from a to b do
           if isprime(i) then
              print(Unquoted, expr2text(i)." is a prime")
           end
         end
       end:

    >> f(20, 30):

                                   23 is a prime

                                   29 is a prime

The parser translates `end` to the appropriate keyword matching the type of the block:

    >> expose(f)

                 proc(a, b)
                   name f;
                   local i;
                 begin
                   for i from a to b do
                     if isprime(i) then
                       print(Unquoted, expr2text(i)." is a prime")
                     end_if
                   end_for
                 end_proc

    >> delete f:

#### Changes

- `end` is a new keyword.

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