Re: Alternative To A Specific Switch Statement

2013-03-15 Thread Dr. Hawkins
On Fri, Mar 15, 2013 at 6:48 AM, david j downs wrote: > > This is probably a hold-over from my formative years programming a > 64KB Atari, but I try to reduce the number of variables used, if > possible. Don't feel too bad about that--i still have a bit of a pre-version 5 MS basic hangover, and s

Re: Alternative To A Specific Switch Statement

2013-03-15 Thread Ender Nafi Elekçioğlu
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 tLe

Re: Alternative To A Specific Switch Statement

2013-03-15 Thread david j downs
t;> >> >> Craig Newman >> >> >> >> >> >> -----Original Message- >> From: Ender Nafi Elekçioğ >> lu >> To: List LiveCode >> Sent: Thu, Mar 14, 2013 1:37 pm >> Subject: Alternative To A Specific Switch S

Re: Alternative To A Specific Switch Statement

2013-03-15 Thread Jim Hurley
Jim > > Message: 1 > Date: Thu, 14 Mar 2013 19:42:05 +0200 > From: Ender Nafi Elek?io?lu > To: List LiveCode > Subject: Alternative To A Specific Switch Statement > Message-ID: <66721958ea974a8480a750047083d...@gmail.com> > Content-Type: text/plain; charset=&qu

Re: Alternative To A Specific Switch Statement

2013-03-15 Thread Colin Holgate
If there are only two possibly outcomes, wouldn't you use an if statement? On Mar 15, 2013, at 8:11 AM, "Peter M. Brigham" wrote: > And combining the suggestions, you could do: > > put sin(pAngleInRadians) into sinCalc > switch sinCalc > case 0 > put 0 into tX > break > default >

Re: Alternative To A Specific Switch Statement

2013-03-15 Thread Peter M. Brigham
On Mar 14, 2013, at 2:08 PM, kee nethery wrote: > I would do the calc once. > I would make the last one default just in case the calc provides you with > something funky. > Kee > > __put sin(pAngleInRadians) into sinCalc > __switch > case sinCalc > 0 > __put 1 into tX > __break > ___

Re: Alternative To A Specific Switch Statement

2013-03-14 Thread kee nethery
I would do the calc once. I would make the last one default just in case the calc provides you with something funky. Kee __put sin(pAngleInRadians) into sinCalc __switch case sinCalc > 0 __put 1 into tX __break case sinCalc = 0 __put 0 into tX __break default __put

Re: Alternative To A Specific Switch Statement

2013-03-14 Thread Alex Tweedly
f 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 To: List LiveCode Sent: Thu, Mar 14, 2013 1:37 pm Subject: Alternative To A Specific Switch Statement Hello Dear LiveCode Gurus,

Re: Alternative To A Specific Switch Statement

2013-03-14 Thread dunbarx
Hi. 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 To: List LiveCode Sent: Thu, Mar 14, 2013 1:37 pm Subject: Alternative To A Specific

Alternative To A Specific Switch Statement

2013-03-14 Thread Ender Nafi Elekçioğlu
Hello Dear LiveCode Gurus, Here is a little code snippet: __switch case sin(pAngleInRadians) > 0 __put 1 into tX __break case sin(pAngleInRadians) = 0 __put 0 into tX __break case sin(pAngleInRadians) < 0 __put -1 into tX __break __end switch It's for a co