[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use end or endif is indifferent?
From: |
Przemek Klosowski |
Subject: |
Re: use end or endif is indifferent? |
Date: |
Wed, 28 Nov 2018 12:36:53 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 11/28/18 11:25 AM, shivax wrote:
I used "end" instead of "endif" in cycles ... it's indifferent?
Please clarify---perhaps you used 'end' after an 'if' block contained in
a 'for' loop, and you wonder if it ends the 'if' or the 'for' block?
for i=1:10
if i==5
i
end
end
'end' nests, so it should work properly, as you can see by running the
above code. Of course it will also work , and will be more readable, if
you write it like this
for i=1:10
if i==5
i
endif
endfor
but it won't be compatible with Matlab...