c.haslam Posted June 26, 2008 Posted June 26, 2008 The help for True and False says: "These keywords should not be used in expressions as AutoIt will not detect this 'misuse' and the results will be unpredictable". What precisely is meant by this?The example is:$bool= Falseif NOT $bool = true Then Msgbox(0,"Bool comparison", "OK")Isn't $bool = true an expression?Or is the help saying that CODEif FileCopy("C:\old\*.*", "C:\new\") = True thenwon't work because FileCopy() returns 1 or 0?...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
Valik Posted June 26, 2008 Posted June 26, 2008 It's referring to context where it doesn't make sense. AutoIt won't reprimand you in those cases. For example: $a = 1 + True
rasim Posted June 26, 2008 Posted June 26, 2008 (edited) c.haslam won't work because FileCopy() returns 1 or 0?Works fine for me: if FileCopy("c:\Help.htm", "D:\", 1) = True then MsgBox(0, "", "True") Check path`s existing. Edited June 26, 2008 by rasim
Valik Posted June 26, 2008 Posted June 26, 2008 c.haslam Works fine for me: if FileCopy("c:\Help.htm", "D:\", 1) = True then MsgBox(0, "", "True") Check path`s existing.Keep in mind, explicitly testing booleans against a literal True or False is stupid. It does not need done and just clutters the code with needless crap.
c.haslam Posted June 28, 2008 Author Posted June 28, 2008 My quibble is with the help file. Perhaps the wording could be improved. Is True equal to 1 and False to 0? Are "If 1 then ..." and "If True then" equivalent? ...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
Moderators SmOke_N Posted June 28, 2008 Moderators Posted June 28, 2008 My quibble is with the help file. Perhaps the wording could be improved. Is True equal to 1 and False to 0? Are "If 1 then ..." and "If True then" equivalent?...chrisZero being the only "False" statement, as less than or greater than zero will be considered a "True" statement.So when using a boolean statement, you need nothing more than If ($bool) Then or If (Not $bool) Then... Need not concern yourself with actual integer values. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now