It quits the FOR loop. I believe the code is better written with the QUIT instead of the GOTO.

S EX=0
F D0=0:0 DO  Q:EX
. S D0=$O(^UTILITY(U,$J,DDF(1),D0))
. S:D0="" D0=-1
. I '$D(^UTILITY(U,$J,DDF(1),D0,0))  S EX=1 Q
. S Z=^UTILITY(U,$J,DDF(1),D0,0)
. D I^DITR

BUT, BUT, BUT.... did you notice all the code that had to be converted to full global references to be compliant with VA programming standards on the use of naked references? (The rule in the SACC about no line starting with a naked reference is a sound one, BTW, born of experience.) Also, you have to add a semaphore (EX in this case) if you want to avoid checking the global existence repeatedly. You can see that by stretching the code out over several lines (what I generally recommend) in this case made the code more verbose because we now have to manage what the context was handling when all on one line in the loop.

Isn't it eye opening to see how many subtleties are in M code? (I am not sure why they wanted to set D0=-1 unless they were going to encounter problems with it being null beyond just the null subscript error in the global reference that follows the check and set of D0.)

P.S.
I notice you have taken to abbreviating commands... ;-) or are you just tearing apart something already written?


Kevin Toppenberg wrote:

Hey all,

I am working with this line of code:

F D0=0:0 S D0=$O(^UTILITY(U,$J,DDF(1),D0)) S:D0=""
D0=-1 Q:'$D(^(D0,0))  S Z=^(0) D I^DITR


My question, does the QUIT in this line quit the For
loop, or quit the function?

Would this be equivalent code:

F D0=0:0 DO  GOTO:'$D(^(D0,0)) LABEL1
. S D0=$O(^UTILITY(U,$J,DDF(1),D0)) . S:D0="" D0=-1 . Q:'$D(^(D0,0)) . S Z=^(0) . D I^DITR

LABEL1
QUIT


Thanks
Kevin


                
__________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members


--
Greg Kreis      http://www.PioneerDataSys.com

"You are today where your thoughts have brought you, you will
  be tomorrow where your thoughts take you." (James Lane Allen)



-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to