use of "end" mandatory for if statement??
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ABTJ
el 1 de Feb. de 2020
Respondida: Walter Roberson
el 1 de Feb. de 2020
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??
0 comentarios
Respuesta aceptada
Walter Roberson
el 1 de Feb. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!