Re: A curious case

2011-03-03 Thread dunbarx
t;put "darkBlue" into newFontColor > break > default >put "black" into newFontColor > end switch > > set the textcolor of fld 1 to newFontColor > -Original Message- From: Nonsanity To: How to use LiveCode Sent: Th

Re: A curious case

2011-03-03 Thread Bob Sneidar
sounds like what I used to get when I talked back to my mom. Bob On Mar 3, 2011, at 12:26 PM, Jim Ault wrote: > only works if you use the 'naked switch' form ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subsc

Re: A curious case

2011-03-03 Thread Jim Ault
On Mar 3, 2011, at 10:40 AM, Nonsanity wrote: Are you sure the "is among" line works there? I apologize for creating confusion with my example. You are correct in that I mixed the TWO forms of the SWITCH structure in the same example. "among the words" only works if you use the 'naked

Re: A curious case

2011-03-03 Thread Nonsanity
On Wed, Mar 2, 2011 at 8:03 PM, Jim Ault wrote: > put the textcolor of fld 1 into testValue > > switch testValue > case "red" > case "yellow" > case "orange" >put "red" into newFontColor >break > case "green" > case "blue" > case "purple" >put "green" into newF

Re: A curious case

2011-03-03 Thread Bob Sneidar
11 > put "never see this" > break > end switch > > > Craig Newman > > > > > > -Original Message- > From: Peter Haworth > To: How to use LiveCode > Sent: Wed, Mar 2, 2011 6:19 pm > Subject: Re: A curious case > > > Sw

Re: A curious case (fixed typo)

2011-03-02 Thread Jim Ault
was: case (testValue is among the words IN "pink coral azure maize") should be: case (testValue is among the words "pink coral azure maize") On Mar 2, 2011, at 5:03 PM, Jim Ault wrote: On Mar 2, 2011, at 3:19 PM, Peter Haworth wrote: Switch is definitley very handy but I wish it was

Re: A curious case

2011-03-02 Thread Jim Ault
On Mar 2, 2011, at 3:19 PM, Peter Haworth wrote: Switch is definitley very handy but I wish it was more flexible. As far as I can tell, the case statement can only test for equality, for example: switch myvar case begins with "xyz" ... generates an error as does anything else oth

Re: A curious case

2011-03-02 Thread Peter Haworth
> > put 3 into temp > switch > case temp < 4 > put "lessThan" > break > case temp = 11 > put "never see this" > break > end switch > > > Craig Newman > > > > > > -Original Message----- > From: Peter Haworth &g

Re: A curious case

2011-03-02 Thread dunbarx
011 6:19 pm Subject: Re: A curious case Switch is definitley very handy but I wish it was more flexible. As far as I can tell, the case statement can only test for equality, for example: switch myvar case begins with "xyz" ... generates an error as does anything else other than ju

Re: A curious case

2011-03-02 Thread Peter Haworth
Switch is definitley very handy but I wish it was more flexible. As far as I can tell, the case statement can only test for equality, for example: switch myvar case begins with "xyz" ... generates an error as does anything else other than just a straight value on the case line. I know

Re: A curious case

2011-03-02 Thread Bob Sneidar
I think the switch control structure is pretty handy for this. If you put all the conditions that will not require a break at the top, then the program will flow down through your conditions and only execute the code inside your case statements if the conditions are true. Towards the end of the

Re: A curious case

2011-03-02 Thread Peter Brigham MD
On Mar 2, 2011, at 11:26 AM, Richard Gaskin wrote: Andre Garzia wrote: I tend to work on the same way. longer forms makes shorter understanding time. I'd rather write more and understand more than write faster and then one week from now, be completely lost in nested mazes Well said. And

Re: A curious case

2011-03-02 Thread Andre Garzia
> > 2. If a function is longer than can be viewed in one screen, it may be a > good candidate for breaking it up into smaller functions. > > Never, ever look into the process_request command inside RevHTTP. it has so many pages that I've considered adding an index... (and yes, there is really n

Re: A curious case

2011-03-02 Thread Bob Sneidar
Well that explains why it was compiling for a while and then stopped! I must have deleted that empty line. Bob On Mar 1, 2011, at 7:04 PM, J. Landman Gay wrote: > You can either rewrite the section using the long form, or put a carriage > return after the last line of the embedded "end if".

Re: A curious case

2011-03-02 Thread J. Landman Gay
On 3/2/11 9:40 AM, Nonsanity wrote: Others have answered this pretty well, but I thought I'd add some examples for clarity - With future readers in mind. The examples are excellent. I think you should add a user note to the "if" page in the docs. That way the info won't get lost. -- Jacque

Re: A curious case

2011-03-02 Thread Richard Gaskin
Andre Garzia wrote: I tend to work on the same way. longer forms makes shorter understanding time. I'd rather write more and understand more than write faster and then one week from now, be completely lost in nested mazes Well said. And sometimes lengthy deeply-nested IFs are good candidates

Re: A curious case

2011-03-02 Thread Andre Garzia
2011/3/2 Björnke von Gierke > I always thought that the dozens of ways to use if-then-else constructs in > LC are too much options. I always use each on it's own line, because > otherwise it's just so hard to read and decipher. Even for super simple > cases: > > if the visible of me then > exit

Re: A curious case

2011-03-02 Thread Björnke von Gierke
I always thought that the dozens of ways to use if-then-else constructs in LC are too much options. I always use each on it's own line, because otherwise it's just so hard to read and decipher. Even for super simple cases: if the visible of me then exit repeat end if On 2 Mar 2011, at 16:40,

Re: A curious case

2011-03-02 Thread Nonsanity
Others have answered this pretty well, but I thought I'd add some examples for clarity - With future readers in mind. The following won't work: if x = 1 then doSomething else if x = 2 then if y = 3 then doSomethingElse else if x = 2 then -- little lost else doThirdThing end if This

Re: A curious case

2011-03-01 Thread dunbarx
orked, and that properly indented structures did not. Craig Newman -Original Message- From: Terry Judd To: How to use LiveCode Sent: Tue, Mar 1, 2011 7:48 pm Subject: Re: A curious case Bob - as you've found out, nested if/then statements tend to break down in unexpected ways wh

Re: A curious case

2011-03-01 Thread J. Landman Gay
On 3/1/11 6:40 PM, Bob Sneidar wrote: Hi all. I just came across a curious issue where I had an if then else control structure inside another if then structure. I *thought* I used toe be able to use the form if statement then -- do somestuff else if anotherstatement then -- do someo

Re: A curious case

2011-03-01 Thread Terry Judd
Bob - as you've found out, nested if/then statements tend to break down in unexpected ways when you mix the short and long forms of the syntax. To be on the safe side, always opt for the long form when nesting statements - these always compile correctly. Terry... On 2/03/11 11:40 AM, "Bob Sneida

A curious case

2011-03-01 Thread Bob Sneidar
Hi all. I just came across a curious issue where I had an if then else control structure inside another if then structure. I *thought* I used toe be able to use the form if statement then -- do somestuff else if anotherstatement then -- do someotherstuff else -- do defaultstuff en