help-octave
[Top][All Lists]
Advanced

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

Re: strange for .. end syntax or bug?


From: Carlo de Falco
Subject: Re: strange for .. end syntax or bug?
Date: Sat, 27 Sep 2008 14:54:29 +0100


On 27/set/08, at 09:37, Francesco Potorti` wrote:

In 3.0.1 I get a case where 'end' and 'endfor' behave differently:

octave> for i=1:2 for j=3:4 disp([i j]) end end
parse error:

syntax error

for i=1:2 for j=3:4 disp([i j]) end end
                                      ^

I think this is normal, correct syntax would be

>> for i=1:2 for j=3:4 disp([i j]); end; end
  1   3
  1   4
  2   3
  2   4

which works fine
octave> for i=1:2 for j=3:4 disp([i j]) endfor endfor
 1   3
 1   4
 2   3
 2   4

I'm surprised this works...

Is this normal?

c.




reply via email to

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