Alternative To A Specific Switch Statement

dunbarx at dunbarx at
Thu Mar 14 13:56:13 EDT 2013


This is a pretty tight switch construct, of a typical form. And very readable. What makes you feel it ought to be tightened?

Craig Newman

-----Original Message-----
From: Ender Nafi Elekçioğ
 lu <endernafi at>
To: List LiveCode <use-livecode at>
Sent: Thu, Mar 14, 2013 1:37 pm
Subject: Alternative To A Specific Switch Statement

Hello Dear LiveCode Gurus,  

Here is a little code snippet:

____case sin(pAngleInRadians) > 0
______put 1 into tX
____case sin(pAngleInRadians) = 0
______put 0 into tX
____case sin(pAngleInRadians) < 0
______put -1 into tX
__end switch

It's for a complex rotation command.
Is there a more elegant way to achieve the same result with built-in functions?
I mean, something like a combination of abs(), max() and/or round()?
Just an intellectual curiosity :)

Thanks for any insights...


~ Ender Nafi

~ ·   together, we're smarter  · ~

~ ·  Keehuna Studio  
~ ·  Sorcerers of Design

use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the Use-livecode mailing list