Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Mumps > Re: Need help w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 9 Topic 957 of 990
Post > Topic >>

Re: Need help with 'if' statement

by Rob Tweed <rtweed@[EMAIL PROTECTED] > May 4, 2008 at 10:33 AM

Here's a tip to make sure you don't fall foul of MUMPS' unusual
if/else construction and its reliance on $t which can inadvertently
cause you problems (another area of weirdness that can cause hours of
debugging grief)

As a matter of course, I structure them as follows:

 if condition do
 . ; whatever needed for main condition
 .; etc....
 else  do
 . ; whatever needed for else condition
 . ;etc...

This use of "dot syntax" gives you the syntactical equivalent to the
C-style:

 if (condition) {
   //whatever you need to do
 }
 else {
   //whatever else you need to do
 }

so it's a reasonably familiar construct for someone new to MUMPS, and
also will behave as you'd expect.

Note the 2 spaces between "else" and "do"



On Sun, 4 May 2008 00:39:17 -0700 (PDT), lmv <lverhulst@[EMAIL PROTECTED]
>
wrote:

>On May 3, 10:23 pm, Duke Normandin <dukeofp...@[EMAIL PROTECTED]
> wrote:
>> Given:
>>
>> set i=1,j=2,k=3
>>
>> what does the following say:
>>
>> if i=0!(j=2) write "yes",!
>>    ^^^^^^^^^
>> this is confusing me. What is the 'nl' command doing there?
>> --
>> Duke Normandin
>
>The ! symbol is an "or" when used with an IF command or as part of a
>condition.  It is a "nl" when used with the write command.
>
>--Leane

---

Rob Tweed
Company: M/Gateway Developments Ltd 
Registered in England: No 3220901
Registered Office: 58 Francis Road,Ashford, Kent TN23 7UR

Web-site: http://www.mgateway.com

SlipstreamUSA: April 2, Renaissance Hotel, Orlando  
http://www.OutOfTheSlipstream.com
 




 9 Posts in Topic:
Need help with 'if' statement
Duke Normandin <dukeof  2008-05-04 03:23:15 
Re: Need help with 'if' statement
rodd@[EMAIL PROTECTED] (  2008-05-04 05:02:00 
Re: Need help with 'if' statement
lmv <lverhulst@[EMAIL   2008-05-04 00:39:17 
Re: Need help with 'if' statement
Rob Tweed <rtweed@[EMA  2008-05-04 10:33:00 
Re: Need help with 'if' statement
Duke Normandin <dukeof  2008-05-04 13:46:34 
Re: Need help with 'if' statement
Aaron Seidman <aaron@[  2008-05-04 15:43:09 
Re: Need help with 'if' statement
Duke Normandin <dukeof  2008-05-04 23:07:27 
Re: Need help with 'if' statement
Aaron Seidman <aaron@[  2008-05-05 00:43:55 
Re: Need help with 'if' statement
Duke Normandin <dukeof  2008-05-05 11:39:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 20 0:15:43 CDT 2008.