Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: goto and label

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57776] Re: goto and label
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 8 Jun 2005 03:21:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 6/7/05 at 2:03 AM, guyi1 at netvision.net.il (Guy Israeli) wrote:

>can someone give clearer instruction on how to use Goto and label
>than the help offers?

Here is an example from the help browser:

In[1]:= 
q = 2; Label[begin]; Print[q]; q += 1; If[q < 6, Goto[begin]]

But note, the same result could have been achieved with

q = 2;
While[q < 6, Print[q]; q += 1]

without the label.

Even better using functional programming

Print/@Range[2,5]

The point is while Mathematica has Goto, it isn't needed in practice.
--
To reply via email subtract one hundred and four


  • Prev by Date: WolframNotebookIndexer
  • Next by Date: Re: Coloring in ShowGraph[]
  • Previous by thread: Re: goto and label
  • Next by thread: 3D Plot formatting