10.9 Оператор try
Исходная форма блока try выглядит так:
try body catch cleanup end_try_catch
где body и cleanup являются необязательными и могут содержать любые выражения или команды Octave. Инструкции в cleanup выполняются только в том случае, если в body возникает ошибка.
Во время выполнения body предупреждения и сообщения об ошибках не выводятся. Если при выполнении body действительно возникает ошибка, cleanup может использовать функции lasterr или lasterror для доступа к тексту сообщения, которое было бы выведено, а также к его идентификатору. Альтернативная форма
try body catch err cleanup end_try_catch
автоматически сохранит результат выполнения lasterror в структуре err. Дополнительные сведения о функциях lasterr и lasterror см. в разделе Ошибки и предупреждения.
© 1996–2026 The Octave Project Developers
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://docs.octave.org/v9.4.0/The-try-Statement.html