Hey all -

I seem to remember this topic from a long time ago but can't find
anything in the archives (lingo-l or direct-l), and of course, not
knowing the name of what I'm looking for doesn't help. :)

What I remember was an 'if/then/else' approach which could be used in a
single line of code, and I can't remember whether it was usable in lingo
or only other ('real') languages. An example might be:

For example: pretend we want to return a percentage, and we have a score
and the total. If the total is 0, we want to avoid a divide by zero so
we might do the following:

return (total=0: 0) ? (a>0: score/total)

ie: return the percentage if total is > 0, or just return 0 if total =
0.

I realize this could be done with:
if (total > 0) then
        dpercent = score/total
else
        dpercent = 0
end if
return dpercent

I'm just looking for a more compact, more 'elegant' solution. I also
understand this is really a minor point. :)


Kendall

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to