Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Goto/Conditional Loops?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2853] Goto/Conditional Loops?
  • From: abindon at gpu.srv.ualberta.ca (Andre Bindon)
  • Date: Wed, 27 Dec 1995 00:48:35 -0500
  • Organization: University of Alberta, Edmonton, Canada

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