use end or endif is indifferent?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

use end or endif is indifferent?

shivax
hi


I used "end" instead of "endif" in cycles
it's indifferent?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: use end or endif is indifferent?

marco atzeri-2
Am 28.11.2018 um 18:04 schrieb shivax:
> hi
>
>
> I used "end" instead of "endif" in cycles
> it's indifferent?
>
>

not clear what you mean for "cycles"

you can use "end" instead of "endif" for closing
a "if" statement, but it is not recommended

https://octave.org/doc/interpreter/Statements.html#index-end-statement

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Reply | Threaded
Open this post in threaded view
|

Re: use end or endif is indifferent?

shivax
Reply | Threaded
Open this post in threaded view
|

Re: use end or endif is indifferent?

Sergei Steshenko
In reply to this post by marco atzeri-2


On Wednesday, November 28, 2018, 7:52:48 PM GMT+2, Marco Atzeri <[hidden email]> wrote:


Am 28.11.2018 um 18:04 schrieb shivax:
> hi
>
>
> I used "end" instead of "endif" in cycles
> it's indifferent?
>
>

not clear what you mean for "cycles"

you can use "end" instead of "endif" for closing
a "if" statement, but it is not recommended


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.


=============================

'not clear what you mean for "cycles"' - most likely loops. In Russian "cycles" is used instead of "loops". Probably not only in Russian.

--Sergei.


Reply | Threaded
Open this post in threaded view
|

Re: use end or endif is indifferent?

inor0627
Sergei Steshenko wrote
> On Wednesday, November 28, 2018, 7:52:48 PM GMT+2, Marco Atzeri &lt;

> marco.atzeri@

> &gt; wrote:  
>  
> you can use "end" instead of "endif" for closing
> a "if" statement, but it is not recommended
>
> https://octave.org/doc/interpreter/Statements.html#index-end-statement

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.

inor



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: use end or endif is indifferent?

Ardid Ramirez, Joan Salvador
  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.