Re: switch case question

2006-11-05 Thread Kay C Lan
On 11/5/06, Dar Scott <[EMAIL PROTECTED]> wrote: The 'switch x' seems to convert x to a string and the 'case y' seems to convert y to a string, and then comparisons are made. Excellent Detective work Dar. It also reinforces a habit I'm trying to develop when writing switch statements, and that

Re: switch case question

2006-11-04 Thread Dar Scott
On Nov 4, 2006, at 10:56 AM, Tereza Snyder wrote: That looked suspicious. Sure enough, a number 6 will match a literal 6 in a case, but a string "6.0" will not match a literal 6 in a case. A string "6.0" will match a 6.0 case. A number 6 will not match a 6.0 in the case. To be clear:

Re: switch case question

2006-11-04 Thread Tereza Snyder
On Nov 4, 2006, at 11:53 AM, Dar Scott wrote: That looked suspicious. Sure enough, a number 6 will match a literal 6 in a case, but a string "6.0" will not match a literal 6 in a case. A string "6.0" will match a 6.0 case. A number 6 will not match a 6.0 in the case. To be clear: the

Re: switch case question

2006-11-04 Thread Dar Scott
On Nov 4, 2006, at 2:35 AM, Mark Smith wrote: This mirrors what I found, too. I'm at a loss as to why this might be. I guess the conclusion has to be that if speed matters in a particular application, then we must test things in context, and find out which approach works best in context.

Re: switch case question

2006-11-04 Thread André.Bisseret
Le 3 nov. 06 à 21:01, Mark Swindell a écrit : H. What do you do to amuse yourself while you're waiting? Mark I catch a glance to the sky: Running your tests, with "if then else" I saw 2 shooting stars; with the "switch", only 1 ;-)) (well, I mean with the fixed scripts !). André O

Re: switch case question

2006-11-04 Thread Mark Smith
This mirrors what I found, too. I'm at a loss as to why this might be. I guess the conclusion has to be that if speed matters in a particular application, then we must test things in context, and find out which approach works best in context. Best, Mark On 4 Nov 2006, at 10:25, André.Biss

Re: switch case question

2006-11-04 Thread André.Bisseret
Hi, I apologize ! Yesterday I was wrong about the time for "switch" ; I copied your script but did not uncomment it :-O) So, my result " 12-13" millisec was not the right one. I am sorry ! After fixing, actually, here – for "If then else" : 94-96 – for "switch" : 50-52. As far as the t

Re: switch case question

2006-11-03 Thread Kay C Lan
On 11/4/06, Dar Scott <[EMAIL PROTECTED]> wrote: I have been running some speed tests and the more I do the more I get confused. Yeah, I know what you mean. When I originally ran my comparisons (months ago) I expected the results to be pretty much the same. When it came back that If-then was f

Re: switch case question

2006-11-03 Thread Dar Scott
On Nov 3, 2006, at 5:40 PM, Kay C Lan wrote: put random(6) into tRandomNo switch (tRandomNo) These tests involve numbers and Mark's tests involve numerals. Maybe that is a clue. -- Dar ___ use-revolution mailing list use-revolution@lists.runre

Re: switch case question

2006-11-03 Thread Dar Scott
On Nov 3, 2006, at 5:40 PM, Kay C Lan wrote: Can't explain why, but if you, and others, are getting faster with Switch, then maybe in 'real' situations it is quicker, which makes me feel even better about using it more:-) I have been running some speed tests and the more I do the more I get

Re: switch case question

2006-11-03 Thread Kay C Lan
OK, I've basically run your scripts but instead of using your exact script and button method I've used Richard Gaskin's excellent revBench, part of his free Devolution tools. So this is what is in one field: put random(6) into tRandomNo if (tRandomNo = 1) then get 1 else if (tRandomNo = 2) th

Re: switch case question

2006-11-03 Thread Mark Smith
Like me, he runs other benchmarks on another computer, of course! :) Mark On 3 Nov 2006, at 21:01, Mark Swindell wrote: H. What do you do to amuse yourself while you're waiting? Mark On Nov 3, 2006, at 11:46 AM, André.Bisseret wrote: Hi Mark, On Mac pro OS X 10.4.8 (2.16 GHz Intel C

Re: switch case question

2006-11-03 Thread Mark Swindell
H. What do you do to amuse yourself while you're waiting? Mark On Nov 3, 2006, at 11:46 AM, André.Bisseret wrote: Hi Mark, On Mac pro OS X 10.4.8 (2.16 GHz Intel Core Duo) I get : for "if then else" : 95-96 milliseconds for "switch" : 12-13 milliseconds Best regards from Grenoble André

Re: switch case question

2006-11-03 Thread André.Bisseret
Hi Mark, On Mac pro OS X 10.4.8 (2.16 GHz Intel Core Duo) I get : for "if then else" : 95-96 milliseconds for "switch" : 12-13 milliseconds Best regards from Grenoble André Le 3 nov. 06 à 20:14, Mark Smith a écrit : Kay, I meant to check this out when I saw your post, but it's taken me a l

Re: switch case question

2006-11-03 Thread Mark Smith
Kay, I meant to check this out when I saw your post, but it's taken me a little time to get to it. I'm pretty sure that for multiple choice situations, a switch structure seems more efficient (ie. faster) than an equivalent multi-way if-then-else structure. I'd be interested to see if you g

Re: switch case question

2006-10-31 Thread Kay C Lan
On 10/22/06, Martin Baxter <[EMAIL PROTECTED]> wrote: put gtimedtest is empty into isempty switch isempty case true stuff break case false other stuff break end switch I've come into this a little late, no internet for a week or so, but be aware that switch is slower than if-th

Re: switch case question

2006-10-22 Thread Mark Swindell
Thanks Martin and Sarah. Mark ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution

Re: switch case question

2006-10-21 Thread Martin Baxter
Mark Swindell wrote: I have a global variable gTimedTest Depending on whether it is empty or not I want to do different things in a handler How do I write this to make it happen with a switch control structure? switch gTimedTest case empty stuff break case not empty other stuff break end

Re: switch case question

2006-10-21 Thread Sarah Reichelt
On 10/22/06, Mark Swindell <[EMAIL PROTECTED]> wrote: I have a global variable gTimedTest Depending on whether it is empty or not I want to do different things in a handler How do I write this to make it happen with a switch control structure? switch gTimedTest case empty stuff break case no

switch case question

2006-10-21 Thread Mark Swindell
I have a global variable gTimedTest Depending on whether it is empty or not I want to do different things in a handler How do I write this to make it happen with a switch control structure? switch gTimedTest case empty stuff break case not empty other stuff break end switch The above doe