Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*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 1996

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

Search the Archive

Re: Goto/Conditional Loops?

  • Subject: [mg2877] Re: [mg2853] Goto/Conditional Loops?
  • From: jesroj at wmatem.eis.uva.es (Jesus ROJO)
  • Date: 4 Jan 1996 04:23:47 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at wri.com

Your message:
> 
> 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];
> 
> . . .  (deteted lines) 
> 
> I'd greatly appreciate all and any help.
> Thanks.
> Andre
> 

Hello,

Some time ago I sent a message to Technical Support
of Mathematica with (more o less) the same subject
that interest you. I sen you my question and their
answer.

Sincerely,
			 Jesus ROJO 

==========================================================
My question:

	    License Number  L2133-4000



Hello,

I find, when using Mathematica, the followng programming 
problem: The instruction 'Goto' cannot be used to jump
out of a loop 'Do'.

For example, the following programme here shown
in a summarized form:

     variable[arguments_]:=Module[{ ... },
     .....................................
     Do[
     .....................................
     Goto[end];
     .....................................
     ,{i,1,5}];
     .....................................
     Label[end];
     .....................................
     ] (* end of Module *)

alwais gives me the following error message:

     CompoundExpression::::goto: Label[end] requested by Goto not found.

I naturally find ways to get round it, but I would
like it to function as expected (for example,
as in FORTRAN).

Is this correct ?  Is there any way to correct it ?

				    Jesus ROJO

============================================================
Their answer:

Dear Jesus Rojo,

You are correct in stating that the Goto[] will function within a
loop or block of statements, but it will not look outside of that
loop or block for a label.

There currently is not a workaround.  Our developers are aware of the
problem, but I'm not sure how much progress will be made on it, as the
philosophy and structure underlying the Mathematica language don't lend
themselves well to global Goto statements.  We do provide the Throw and
Catch commands (on pages 294-5 of the Mathematica book) for a more
global response, if you're interesting in looking at that.

Thank you for your question.  I'm sorry I couldn't be of more help.

Sincerely,

John Fultz
Technical Support
Wolfram Research, Inc.

--
---------------------------------------
|  Jesus ROJO                         |
|  Dpto. de Matematica Aplicada       |
|  E.T.S. de Ingenieros Industriales  |
|  Paseo del Cauce s/n                |
|  47011 VALLADOLID, Spain            |
|  Phone : 34 - 83 - 42 33 90         |
|  Fax   : 34 - 83 - 42 34 06         |
|  e-mail: jesroj at wmatem.eis.uva.es   |
---------------------------------------



  • Prev by Date: Re: Goto/Conditional Loops?
  • Next by Date: Problems with Mathematica on Dec-Alpha
  • Previous by thread: Re: Goto/Conditional Loops?
  • Next by thread: Problems with Mathematica on Dec-Alpha