This is perfect - clear succinct and very useful, and exactly what naive users
mean when they find the documentation a little sketchy. Its having to work
out stuff like this by hand from the dictionary and then get it down in notes
someplace. Thanks.
But... why not get it into the online h
As usual I'm late to the thread.
You might like to read a thread that covered this a while back. Search for:
Subject: switch case question
Date: 10/22/06
From: Mark Swindell
The thread includes some great detective work by Dar who figured out
occasions when switch will be faster than if-then.
On 2/28/07 7:45 PM, "Shao Sean" <[EMAIL PROTECTED]> wrote:
Thanks a mill
Hershel
>> Sorry, what do you mean that IF-ELSE-IF is always evaluated?
>
> If you have a 20 line nested IF-ELSE-IF statement and the one that
> matches your current situation is the 20th one, the previous 19 are
> evaluated
Sorry, what do you mean that IF-ELSE-IF is always evaluated?
If you have a 20 line nested IF-ELSE-IF statement and the one that
matches your current situation is the 20th one, the previous 19 are
evaluated (thankfully Rev uses some short-circuited methods to speed it
up)
In a SWITCH stateme
On 2/28/07 6:00 AM, "Mark Schonewille" <[EMAIL PROTECTED]>
wrote:
> Sure, Hershel, nested switch control structures are possible, just
> like nested if-then-else control structures.
Thanks,
Hershel
>
> switch myVar
> case 1
> case 2
If this = to Case 1 or 2 and the "and" will work the same "Ca
Sure, Hershel, nested switch control structures are possible, just
like nested if-then-else control structures.
switch myVar
case 1
case 2
-- do something
break
case 3
switch myVar2
case "a"
-- do something
break
case "b"
-- do something else
break
On 2/27/07 4:53 PM, "Mark Schonewille" <[EMAIL PROTECTED]>
wrote:
Thanks, I saw it after I asked sorry about that.
But by the way besides speed I think there is an additional difference which
I think is the nested if's, vs. case I donĀ¹t think this is possible
Thanks, Hershel
> Hershel,
>
> There
Hershel,
There is an example of this in the docs:
switch (the number of this card)
case 1
case (the number of cards)
-- both the above case conditions execute the following
-- statements:
beep
break
default
go next card
end switch
"Default" is equal
On 2/26/07 3:39 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
> Hershel Fisch wrote:
>> On 2/26/07 2:27 PM, "Shao Sean" wrote:
>>
>>> There are differences between SWITCH and IF-ELSE-IF statements in other
>>> languages, but in regards to Revolution someone from the engine team
>>> would be be
Hershel Fisch wrote:
On 2/26/07 2:27 PM, "Shao Sean" wrote:
There are differences between SWITCH and IF-ELSE-IF statements in other
languages, but in regards to Revolution someone from the engine team
would be best to answer it.
In many languages SWITCH statements are converted into a hash t
On 2/26/07 2:27 PM, "Shao Sean" <[EMAIL PROTECTED]> wrote:
> There are differences between SWITCH and IF-ELSE-IF statements in other
> languages, but in regards to Revolution someone from the engine team
> would be best to answer it.
>
> In many languages SWITCH statements are converted into a ha
On 2/26/07 1:37 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
> Hershel wrote:
>> Is the below the original code, if yes I'd make some comments if possible.
>
> The switch example is the same, but the if-then example was rewritten in
> an attempt to better match the logic of the switch block.
On 2/26/07 1:50 PM, "Jim Ault" <[EMAIL PROTECTED]> wrote:
> So the bottom line is that if you are executing this IF or SWITCH you can
> expect to waste
>
> Per trip cost is
>
> 89-74/10,000
> = 15/10,000 milliseconds
> = 0.0015 milliseconds
> which is 1.5 millionths of a second longer per
Jim Ault wrote:
So the bottom line is that if you are executing this IF or SWITCH you can
expect to waste
Per trip cost is
89-74/10,000
= 15/10,000 milliseconds
= 0.0015 milliseconds
which is 1.5 millionths of a second longer per loop to use IF
A million here, a million there, and prett
There are differences between SWITCH and IF-ELSE-IF statements in other
languages, but in regards to Revolution someone from the engine team
would be best to answer it.
In many languages SWITCH statements are converted into a hash table for
much quicker lookups and using a SWITCH once or twice
So the bottom line is that if you are executing this IF or SWITCH you can
expect to waste
Per trip cost is
89-74/10,000
= 15/10,000 milliseconds
= 0.0015 milliseconds
which is 1.5 millionths of a second longer per loop to use IF
A million here, a million there, and pretty soon your talking
Hershel wrote:
Is the below the original code, if yes I'd make some comments if possible.
The switch example is the same, but the if-then example was rewritten in
an attempt to better match the logic of the switch block.
local sResult
on mouseUp
-- number of test iterations:
put 1 in
Richard, I bow to your more extensive test. All I did was a simple
five-way switch/if (based on a random input) that actually did
nothing, so I think your test is probably more useful.
Best,
Mark
On 26 Feb 2007, at 17:35, Richard Gaskin wrote:
Mark Smith wrote:
I just ran a very simple b
On 2/26/07 12:35 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
Hi,
Is the below the original code, if yes I'd make some comments if possible.
> Mark Smith wrote:
>> I just ran a very simple benchmark test, which suggests that if/then
>> goes about 20% faster than switch/case.
>
> I get differen
Mark Smith wrote:
I just ran a very simple benchmark test, which suggests that if/then
goes about 20% faster than switch/case.
I get different results here, but I had to rewrite the if-then test as
the example posted as it wasn't executing the same logic as the switch
block. In the "if" exa
On 2/26/07 4:20 AM, "Mark Smith" <[EMAIL PROTECTED]> wrote:
> I just ran a very simple benchmark test, which suggests that if/then
> goes about 20% faster than switch/case.
WOW
Thanks, Hershel
>
> Best,
>
> Mark
>
> On 26 Feb 2007, at 02:33, Hershel Fisch wrote:
>
>> On 2/25/07 9:21 PM, "Jim
I just ran a very simple benchmark test, which suggests that if/then
goes about 20% faster than switch/case.
Best,
Mark
On 26 Feb 2007, at 02:33, Hershel Fisch wrote:
On 2/25/07 9:21 PM, "Jim Ault" <[EMAIL PROTECTED]> wrote:
How about speed?
Hershel
On 2/25/07 6:16 PM, "Hershel Fisch" <[
Richard Gaskin wrote (regarding "case" staements):
I
don't know if the literature supports that anecdotal observation, but
since most languages include case there must be good value in it.
I keep hearing it runs faster than if/else statements. I don't know if
that's true. Anyway, I'm like y
>>> Hi every one, how would one put the differences between multiple if, else
>>> if's vs. case's
In my case it is usually a matter of scale. I tend to start by
thinking of using "if" but if the number of possibilities goes over 3,
then I will tend to go with "case".
Sarah
Hershel Fisch wrote:
Hi every one, how would one put the differences between multiple if, else
if's vs. case's
In many respects they're quite similar, and for many uses the choice of
one over another can be a matter of stylistic preference.
But there is at least one functional difference which
On 2/25/07 9:31 PM, "Richard Gaskin" <[EMAIL PROTECTED]> wrote:
Wouldn't be the same as
If tVar ="a" or tVar ="b" then
DoThing1
Else
If tVar = "c" then
DoTing2
Else
If tVar ="d" then
DoTing4
Enf if
End if
End if
Hershel, Thanks
> Hershel Fisch wrote:
>> Hi every one, ho
On 2/25/07 9:21 PM, "Jim Ault" <[EMAIL PROTECTED]> wrote:
How about speed?
Hershel
>
> On 2/25/07 6:16 PM, "Hershel Fisch" <[EMAIL PROTECTED]> wrote:
>
>> Hi every one, how would one put the differences between multiple if, else
>> if's vs. case's
>
> It is a matter of personal choice and prog
Hershel Fisch wrote:
Hi every one, how would one put the differences between multiple if, else
if's vs. case's
In many respects they're quite similar, and for many uses the choice of
one over another can be a matter of stylistic preference.
But there is at least one functional difference whi
On 2/25/07 6:16 PM, "Hershel Fisch" <[EMAIL PROTECTED]> wrote:
> Hi every one, how would one put the differences between multiple if, else
> if's vs. case's
It is a matter of personal choice and programming style.
They both work, and without good notations can become just as confusing next
year
Hi every one, how would one put the differences between multiple if, else
if's vs. case's
Thanks, Hershel
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
prefer
30 matches
Mail list logo