필터 지우기
필터 지우기

use of "end" mandatory for if statement??

조회 수: 14 (최근 30일)
ABTJ
ABTJ 2020년 2월 1일
답변: Walter Roberson 2020년 2월 1일
I want to that if we are using the if statement in our code let say in our function,then is it must to use a separate"end" for if statement other than the end of function??

채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 1일
Every if must have a matching end statement. This is always required.
It is not always required that every function has a matching end statement. It is required for functions inside of scripts, and if you use nested functions. However if you have a .m file that starts with function and you do not have nested functions then you can omit the end statement matching every function statement. You cannot mix and match in one file: either do not use any end matching function or else every function must have a matching end. You cannot have some with matching and others without.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by