[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39168] "break" in subroutine has no effect on
From: |
Ruhollah |
Subject: |
[Octave-bug-tracker] [bug #39168] "break" in subroutine has no effect on loop in main. |
Date: |
Wed, 05 Jun 2013 08:42:12 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.0; rv:21.0) Gecko/20100101 Firefox/21.0 |
URL:
<http://savannah.gnu.org/bugs/?39168>
Summary: "break" in subroutine has no effect on loop in main.
Project: GNU Octave
Submitted by: paryshaan
Submitted on: Wed 05 Jun 2013 08:42:11 AM GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.6.4
Operating System: Microsoft Windows
_______________________________________________________
Details:
when a main file with a loop calls a subroutine with "break" command, the
command doesn't affect the loop of main file. It should exit from the loop,
but it only exits from the second file.
For example: if we have 2 m files "Main.m" and "Subroutine.m" like these:
Main:
for k=1:3
k
Subroutine
disp('Loop finished')
endfor
Subroutine:
if k==2
break
endif
disp('Subroutine finished')
Now if we run "Main" the result will be:
k = 1.00
Subroutine finished
Loop finished
k = 2.00
Loop finished
k = 3.00
Subroutine finished
Loop finished
Now if we replace "break" with "continue" in "Subroutine" and run "Main" again
we have:
k = 1.00
Subroutine finished
Loop finished
k = 2.00
k = 3.00
Subroutine finished
Loop finished
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39168>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #39168] "break" in subroutine has no effect on loop in main.,
Ruhollah <=