Loops and conditional statements
- | - |
---|---|
if, elseif, else | Execute statement when condition is true |
switch, case, otherwise | Execute one of multiple sets of statements |
for | A for loop used to repeat a specified number of times |
while | A while loop that executes repeatedly while a condition is true |
try, catch | Execute the statement and catch the resulting error |
break | Terminate execution of a for or while loop |
return | Return control to the calling script or function |
continue | Passes control to the next iteration of a for or while loop |
pause | Temporarily suspend the execution of MATLAB |
parfor | Parallel for loop |
end | Terminate a code block or indicate the maximum array index |
Comments