MathGroup Archive 2005

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

Search the Archive

Re: goto and label


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