Alternative To A Specific Switch Statement

Ender Nafi Elekçioğlu endernafi at gmail.com
Fri Mar 15 13:20:53 EDT 2013


Hi all,

@Craig
Well, I like shorter codes.
Maybe it's an illusion of "the shorter, the faster" ?

Nevertheless, I seek a level of sophistication balanced with readability in my code.
A very, very simple example:

__put random(2) into tRandomNumber
__if tRandomNumber is 1 then
____put "L" into tLeftOrRight
__else
____put "R" into tLeftOrRight
__end if

vs.

__put any item of "L,R" into tLeftOrRight

Isn't this much more elegant programming?
That was my intention by posting the question.

@Alex, Kee, Peter, David
I followed your advice,
did the calc once and used *sinCalc/abs(sinCalc)*

@Colin
You're right, *if* would do just fine :)

@Jim Hurley
*atan2* function looks very promising, I'll dig deep; thanks...



Thanks, all of you…
I'm at the very beginning of that learning curve, you {all the gurus in lists and forums} helped a lot.



Best,

~ Ender Nafi



~ ·  … together, we're smarter … · ~


More information about the use-livecode mailing list