I really like to use switch for any logic more than a single if-then-else.
Switch statements, due to their fall-through and default behaviors, can
handle more logic *conditions* than if-then
switch tInput
case 0
case 1
    put tInput after tOut
case 2
   put tInput after tOut
case 3
    put tInput after tOut
    break
case 4
    put tInput after tOut
case 5
    put tInput after tOut
    break
default
    put tInput after tOut
end switch


tInput - tOut

0    ==>  123
1    ==>  123
2    ==>  23
3    ==>  3
4    ==>  45
5    ==>  5
6    ==>  6
7    ==>  7
...

when one gets used to the structure of a switch statement, it really looks
like it functions, and it's quite simple. Same thing with arrays.


All programming is simple, once one can break it down as smaller ideas put
together as a machine.

-------------------------
Stephen Barncard
San Francisco
http://houseofcubes.com/disco.irev


2009/9/5 Colin Holgate <co...@verizon.net>

>
> On Sep 5, 2009, at 12:03 PM, Richmond Mathewson wrote:
>
>  Using SWITCH statements,
>>
>
>
> Although switch statements can be useful, you don't have to use them. So
> your old code could stay as it is, and you would just use switch in the
> future if it's appropriate. You can often get away without an if or a
> switch. Like with your example:
>
> do item Goofy of "something-or-other,something-more-foolish"
>
>
>
_______________________________________________
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

Reply via email to