Re: Switch Statement

2007-07-12 Thread Rob Cozens
Mark, et al: I believe that form of the switch statement with no argument may be unique to Transcript. I do use it to handle all sorts of corner conditions that would otherwise result in really ugly code, but I have to twist my head around it each time, That form of switch introduces the

Re: Switch Statement

2007-07-12 Thread David Bovill
Much clearer - thanks everyone - I think the documentation should be a little clearer with this? So I had a go - which proved pretty difficult - I don't envy anyone trying to do technical documentation. Here is the best I can do for now. I added a few examples and i think the hypertext links to d

Re: Switch Statement

2007-07-12 Thread Mark Wieder
Eric- switch -- note there is nothing more here ;-) ...and I believe that form of the switch statement with no argument may be unique to Transcript. I do use it to handle all sorts of corner conditions that would otherwise result in really ugly code, but I have to twist my head around it

Re: Switch Statement

2007-07-12 Thread Rob Cozens
Hi David, I use the switch statement a lot - but only for basic "case" tests and have not been able to get: "If the caseValue is equal to the switchExpression, or the caseCondition evaluates to true" Don't forget that switch logic falls through from case to ca

Re: Switch Statement

2007-07-12 Thread Eric Chatonet
Hi David, If you specify a variable just after the switch statement, each case value refers to this variable. So, in your case, try: switch -- note there is nothing more here ;-) case mainChoice = "Go to script object" break case (mainChoice i

Switch Statement

2007-07-12 Thread David
I use the switch statement a lot - but only for basic "case" tests and have not been able to get: "If the caseValue is equal to the switchExpression, or the caseCondition evaluates to true" working. Here is an example that I just changed from "if then else" - wh

Re: Switch statement

2004-08-04 Thread Andre Garzia
On Aug 4, 2004, at 3:28 PM, Bill wrote: else put "go visit Andre in South America" into fld "e6" end if Oh boy if there's a bug in this software I'll end with ballast or illegal aliens in my home :-) Andre -- Andre Alves Garzia  2004  BRAZIL http://studio.soapdog.org __

Switch statement

2004-08-04 Thread Bill
Thanks this worked. I thought you had to use a switch statement because an if statement could only have one "else". Now I realize a switch/case statement is only used because it is faster for comparing one item against other items to match exactly. This is an example of how an old

Re: Switch statement

2004-08-04 Thread Nonsanity
If you are searching for your words in a larger string, then this won't work with a case statement. Case statements are better (that is, slightly faster - maybe) than if-then-else chains when you are comparing a single variable with multiple constants. If you need to perform processing (like a

Re: Switch statement

2004-08-04 Thread Rob Cozens
switch (Text) contains case "ballast" put "no cargo" into fld "e4" break case "bulk" put "oil bunkers" into fld "e5" break default put "general cargo" into fld "e6" end switch The above is a simple switch where (Text) is more than one word and I am looki

Re: Switch statement

2004-08-04 Thread Rob Cozens
switch (Text) contains case "ballast" put "no cargo" into fld "e4" break case "bulk" put "oil bunkers" into fld "e5" break default put "general cargo" into fld "e6" end switch The above is a simple switch where (Text) is more than one word and I am looki

Switch statement

2004-08-04 Thread Bill
switch (Text) contains case "ballast" put "no cargo" into fld "e4" break case "bulk" put "oil bunkers" into fld "e5" break default put "general cargo" into fld "e6" end switch The above is a simple switch where (Text) is more than one word and I am look