Re: Conflicting Switch Statements
- To: mathgroup at smc.vnet.net
- Subject: [mg91408] Re: Conflicting Switch Statements
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 20 Aug 2008 06:22:50 -0400 (EDT)
- Organization: Uni Leipzig
- References: <g8gj3s$et6$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, since Switch[var2,0,(result=3),1,(result=4)]; is executed *after* Switch[var1,0,(result=1),1,(result=2)]; it will always win because you mean something like If[changed[var1], Switch[var1, 0, (result = 1), 1, (result = 2)] ]; If[changed[var2], Switch[var2, 0, (result = 3), 1, (result = 4)] ]; Regards Jens Todd Allen wrote: > Hi Folks, > > Why is it if you place 2 switch statements next to each other (as in the test code below), the presence of the second switch interferes with proper execution of the first? > > I feel like I'm missing something fundamental. Would you have any ideas on how to make both switch statements co-exist peacefully, as I really need a good way to control which portions of code get executed inside a manipulate statement? > > Best regards, > Todd > > > > Manipulate[ > > Switch[var1,0,(result=1),1,(result=2)]; > > Switch[var2,0,(result=3),1,(result=4)]; > > result, > > {{var1,0},{0->"Ok",1->"Now"},ControlType->PopupMenu}, > > {{var2,0},{0->"Please",1->"Work"},ControlType->PopupMenu}] > > > >