octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use end or endif is indifferent?


From: Luca Manzari
Subject: Re: use end or endif is indifferent?
Date: Thu, 29 Nov 2018 16:17:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Octave already treats whatever follows % as a comment, so nothing prevents you from writing end%if or end%for already. Doing so makes for code that is both Octave and Matlab compatible.

/Luca

On 2018-11-29 14:43, Ardid Ramirez, Joan Salvador wrote:
   Hello Sergei,
this is correct for Octave, but please keep in mind that Matlab (2016a) does
   not support "endif" and "endfor". So when you have to cooparate with people
   using Matlab, you could instead use "end%if" and "end%for" which will
   increase readability of your code, though you will losse Octave's advanced
   diagnostic abilities as mentioned in your link.
Mmm, thinking about it, it would actually be great if Octave would accept 
end%if as an alias of endif and end%for as an alias of endfor. This would bring 
the best of the two worlds, keeping all Octave's goodness, while keeping Matlab 
compatibility.

Sending it to maintainers to see if Octave Devs would consider this as a 
feasible option...

....
a.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]