end

Close a block statement

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Description

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

Examples

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:

See Also

MuPAD Functions