Kevin, did you get Ron's little example to run? did you see that it said "a" was true, and "b" was true, but a and b were not true? Chip
_____ From: Ron Parker [mailto:[email protected]] Sent: Friday, October 15, 2010 4:37 PM To: [email protected] Subject: Re: a little contest: who's got the biggest script? On a related note, try pasting this line into immed and see if you can figure out why it does what it does: a = 1 : b = 2 : if a then print "a" : if b then print "b" : if a and b then print "a and b" On 10/15/2010 4:30 PM, Ron Parker wrote: It's best to not know this, or at least to code like you don't know this. You should never need to compare a boolean variable to any constant, and you should never ever do anything involving the numeric value of a boolean variable. If you do need a constant for some other reason, use vbTrue and vbFalse. Otherwise, someday, when you least expect it, there'll be a new version of the interpreter and it'll change. (This has happened to me. It wasn't VBScript, but it was a BASIC interpreter.) On 10/15/2010 4:22 PM, Aaron Smith wrote: In VBScript, True is -1, False is 0. Aaron On 10/15/2010 4:14 PM, Kevin Huber wrote: Hi Aaron: I was thinking that if c was either true or false, then c is boolean, which would suggest that: c = 1 is equivalent to c = true and c = 0 is equivalent to c = false On 10/15/10, Aaron Smith <mailto:[email protected]> <[email protected]> wrote: On 10/15/2010 3:35 PM, Kevin Huber wrote: I'm confused. Is the if..then..else example that you gave supposed to be equivalent to the line: c = (a = b)? That's correct. I thought that c could = either 1 or 0, which would mean that if a = b then c = 1 else c = 0 None of the variables in my example where ever assigned any values, so I'm not sure where you're pulling 1 and 0 from. The shorthand c = (a = b) is the same as the long winded if example. If a and b are equal, then the value of that evaluation is stored in c. If they are not, then the value of that evaluation is stored in c. Either way, the value being assigned to c is not any kind of direct mathematical computation on a and b, but rather a comparison of their values. That's what the parenthesis are doing. The result is a report on whether or not (if then else) they're equal. Aaron -- Aaron Smith Product Support Specialist * Web Development GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team. c = false> -- Aaron Smith Product Support Specialist * Web Development GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team.
