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
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
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
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
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
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
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
>
> 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
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
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
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
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
>
> 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
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".
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
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
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
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,
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
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
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
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
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
23 matches
Mail list logo