X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Feb 2006 06:23 AM by  anon
gaussfit
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 Feb 2006 06:23 AM
    what does it mean: (nt eq 4) ? 0 : 1

    Deleted User



    New Member


    Posts:
    New Member


    --
    24 Feb 2006 06:23 AM
    I think this is a language syntax convention that IDL borrowed from C. The use in GAUSSFIT, I believe, is: c = POLY_FIT(x, y, (nt eq 4) ? 0 : 1, yf) The literal meaning in an alternative longer code statement is: IF nt EQ 4 THEN $ c = POLY_FIT(x, y, 0, yf) $ ELSE $ c = POLY_FIT(x, y, 1, yf) Many C programmers (and perhaps Java programmers as well) have used this not-very-intuitive-but-much-shorter syntax since their schooling, so we DO see it often IDL's 'lib' .pro files. If you practise with it a few times, you get used to it. IDL's Online Help discusses it in the index topic "?: ternary operator". Bien a vous, James Jones
    You are not authorized to post a reply.