help-octave
[Top][All Lists]
Advanced

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

Re: Goto or equivalent?


From: Paul Kienzle
Subject: Re: Goto or equivalent?
Date: Fri, 16 Apr 2004 22:56:46 -0400


On Apr 16, 2004, at 7:52 AM, Vic Norton wrote:

Is there any goto or equivalent in octave? I can't seem to find one.

At the simplest level I would like to write something like

   ...
   code
   ...
   if (you_are_done)
      goto END_MAIN;
   endif
   ...
   more code if not done
   ...
   END_MAIN:;

This mechanism can easily accomplished in a subroutine. Just replace "goto END_MAIN" with "return" and forget the last line. But can it be done in the main program without a big if-block?


A big while block with break/continue is more flexible than if.

Paul Kienzle
address@hidden



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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