Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can end statement replace endfor statement in Octave?

This link illustrates that we should use endfor statement to close the scope of for loop.

But replacing it with end results into the same behavior.

Does using end rather than endfor have any unexpected side effects?

like image 436
Saurav Sahu Avatar asked Jun 17 '26 07:06

Saurav Sahu


1 Answers

end is synonymous with endfor when closing a for loop.

The only side effect of using end is that your code will also be compatible with MATLAB, as endfor is an extension of the language invented by Octave. I recommend that you do not use endfor and the like (endif, endfunction, endswitch, endwhile).

like image 62
Cris Luengo Avatar answered Jun 20 '26 00:06

Cris Luengo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!