Re: a goto command???



....Post any bit of code with a goto in it and somebody here will be
able to show you the same functionality written without it...

Ok, I would like that! I am implementing the Lenstra-Lenstra-Lovasz
algorithm in Matlab and in the original article the pseudo-code
roughly looks like this:

***
compute gram-schmidt constants for a given basis b;
k = 2;

(1) do a subroutine;

if(condition) goto (2);

do a subroutine;

if(k=n) terminate;
k = k+1;
goto (1)

(2) do some calculations
k = k-1;
goto (1)
***

So, how should I work around the goto's here?
.



Relevant Pages

  • Re: Problem writing code to go to a label after calling a procedure
    ... >>I first tried to create procedures for parts of the program to avoid ... Thanks for the advice J French. ... I know a good program structure avoids many goto ... subroutine, this is somthing I found that Visual Basic can't do. ...
    (comp.lang.basic.visual.misc)
  • Re: Use of subroutines
    ... >>I still maintain that a subroutine is first and foremost a GOTO ... > GOTO transfers control with no provision to return and continue ... > continue execution. ...
    (comp.lang.fortran)
  • Re: Use of subroutines
    ... Go tos are not evil. ... >I still maintain that a subroutine is first and foremost a GOTO ...
    (comp.lang.fortran)
  • Re: Use of subroutines
    ... >>I still maintain that a subroutine is first and foremost a GOTO ... > Kind of like sending out for a pizza. ... The original programmer may never have ...
    (comp.lang.fortran)
  • Re: When MV is not an option
    ... Each prompt calls a local subroutine to validate some test. ... a GoTo or STOP. ... >programming language... ...
    (comp.databases.pick)