18 General programming
endfor, endwhile, endif etc. can all be replaced by end.
| octave | description |
|---|---|
for x = 1:10 |
for loop |
endfor |
|
while (x <= 10) |
while loop |
endwhile |
|
do |
do-until loop |
until (x > 10) |
|
if (x < 5) |
if-then-else |
elseif (x < 6) |
|
else |
|
endif |
|
switch (tf) |
if-then-else |
case "true" |
|
case "false" |
|
otherwise |
|
endswitch |
|
break |
exit innermost loop |
continue |
go to start of innermost loop |
return |
jump back from function to caller |
try |
cleanup only on exception |
catch |
|
undwind_protect |
cleanup always |
undwind_protect_cleanup |