You might want to look up Knuth's article "Structured Programming with GOTOs" in "Literate Programming". I, too, have been taught to avoid GOTOs like the plague (and generally consider it good advice), but the real problem with the GOTO statement is what people do with it. In MUMPS, you do sometimes need it to emulate control flow structures that are directly supported in other languages.

===
Gregory Woodhouse
[EMAIL PROTECTED]

"The policy of being too cautious is
the greatest risk of all."
--Jawaharlal Nehru


On Sep 14, 2005, at 5:17 PM, Kevin Toppenberg wrote:

I have always been taught that goto's should be avoided like the
plague.  And that is the general rule I have always followed before
working with M.

One issue is that having to nest block of code with leader dots (e.g.
. . . S I=1), makes it more awkard in my opion.  So it becomes easier
to have this:

MyFunct(a,b)
  new result set result=-1
  if $get(a)="" goto FuncDone
  if $get(b)="" goto FuncDone

  set result=a*b
  ;//more code here.

FuncDone
  quit result


as compared to

MyFunct(a,b)
  new result set result=-1
  if ($get(a)'="")&($get(b)="") do
  . set result=a*b
  . ;//more code here

FuncDone
  quit result


Another issue is that the for loops in M don't have a "break" or
"continue" command, which makes the syntax a bit more awkward.

Kevin




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to