help-octave
[Top][All Lists]
Advanced

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

Re: Bug in "break" command


From: c.
Subject: Re: Bug in "break" command
Date: Mon, 3 Jun 2013 19:30:52 +0200

On 3 Jun 2013, at 16:05, Jordi Gutiérrez Hermoso <address@hidden> wrote:

> I don't think this is a bug. In the second file, the break is not
> inside any loop, so there is no loop to exit. A function call creates
> a new scope, and there is no loop in this scope from which to break.
> 
> Unless Matlab behaves differently, I can't consider this a bug (and it
> does, it's a bug in Matlab that we'll have to duplicate in Octave).

but a call to a script does not create its own scope, it is like a macro 
invocation in C …

and indeed the attached script returns
>> file_a
     1

in matlab  while in octave

>> file_a
 1
 2
 3
>> 

so this is at least a compatibilty bug, which is possibly relate to bug #38236.
Paryashaan, could you please submit a bug report here:
https://savannah.gnu.org/bugs/?group=octave

Thanks!
c.


file_a.m:

for ii=1:3
  file_b
  disp (ii)
end


file_b.m:

if ii==2
  break
end



reply via email to

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