MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Goto/Conditional Loops?


Hi! I've been working at this program for a while and seem to be having a 
problem that I can't seem to see.
I have a small conditional loop that works:

Label[skip];
Clear[question];
y:=Input["question"];
If[question==y , Print["yes"];Goto[skip],Goto[dnskip]];
Label[dnskip];
Print[dnskip];

This one reads the label and then works properly.However This one doesn't 
work properly:

Label[ident];
Do[markdata[[n,1]]=idnum[[n]],{n,1,stnum}];
Clear[checkid,n];
checkid:=Input["Is this correct?"];
If[n==checkid,Goto[ident],Print["save file and continue"]];
Off[SetDelayed::write];
<<Statistics`DescriptiveStatistics`;
Abort[]

Cna someone tell me why the Goto doesn't remember the label?
And the book says that Goto scans the present complex expression for the 
Label. Mine only works if the Label was before the Condition. 
I'd greatly appreciate all and any help.
Thanks.
Andre



  • Prev by Date: Re: Programming
  • Next by Date: Re: Mathematica as a programming language.
  • Previous by thread: Transpose of a 1x15 matrix...HOW?
  • Next by thread: Can't interrupt the current evaluation