(02-12-2026, 10:29 PM)a740g Wrote: You can. For example:
Code: (Select All)age = 16
PRINT _IIF(age < 13, "child", _IIF(age < 20, "teenager", _IIF(age < 65, "adult", "senior")))
But I have never checked how deep though. I'd suggest not overdoing it. IMO, more than 2 levels makes a code hard to read.
If your code is getting to this point and depth of IIFing, then I'd IIFing just use SELECT CASE. It's much more readable to me.
Code: (Select All)
SELECT CASE age
CASE <13: PRINT "child"
CASE <20: PRINT "teenager"
CASE <65: PRINT "adult"
CASE ELSE: PRINT "senior"
END SELECT
One glance at the above and I can decipher what the heck it's doing with no thought or brain power really needed.
That compound IFF statement? It's not intuitive. I'd have to stop and take a moment to wrap my brain around it, and that makes it much less viable as *GOOD* code, in my opinion.
Just because you CAN do something doesn't mean you really should. It's often better to just stick to the simple constructs which you (and everyone else) recognize and understand inherently. It makes sharing, upkeeping, and maintaining code a helluva lot easier over time.

