rudi Posted March 16, 2020 Share Posted March 16, 2020 Hi. for the "==" operator the language reference is telling: Tests if two strings are equal. Case-sensitive. The left and right values are converted to strings if they are not strings already. This operator should only be used if string comparisons need to be case-sensitive. This operator "==" can also be used to check, if a value is really "true" or just not 0 / false: ; Autoit v 3.3.14.5 Dim $aValues[9] = [True, False, "Just-some-string",-2,-1,0,1,2,100] For $CheckThis In $aValues ConsoleWrite("-------------- " & $CheckThis & " ----------------" & @CRLF) If $CheckThis = True Then ConsoleWrite("It's true, when using one ""="" doing the compare." & @CRLF) If $CheckThis == True Then ConsoleWrite("still true, when using two ""=="" doing the compare." & @CRLF) Else ConsoleWrite("It's *NO MORE* true, when using two ""=="" doing the compare!" & @CRLF) EndIf Else ConsoleWrite("It's *NOT* true" & @CRLF) EndIf Next -------------- True ---------------- It's true, when using one "=" doing the compare. still true, when using two "==" doing the compare. -------------- False ---------------- It's *NOT* true -------------- Just-some-string ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! -------------- -2 ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! -------------- -1 ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! -------------- 0 ---------------- It's *NOT* true -------------- 1 ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! -------------- 2 ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! -------------- 100 ---------------- It's true, when using one "=" doing the compare. It's *NO MORE* true, when using two "==" doing the compare! Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
argumentum Posted March 16, 2020 Share Posted March 16, 2020 ...case sensitivity or exactness. Do you really feel that the help file needs to be explicit in regards of non-string operations ?, it is implied. Anyone with experience knows. If to amend the help file, how would you phrase it @rudi ? Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted March 16, 2020 Share Posted March 16, 2020 From my personal view, it comes from other other programming languages. Most novice programmers don't bother to look at those simplest operations, they put codes together and if it works without error, it must be right... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
rudi Posted March 31, 2020 Author Share Posted March 31, 2020 IMHO precise documentation is always a very valuable thing. To be able to tell if a result value is really TRUE or just "not zero" might be helpful. Not much extra text, pointing out the difference clearly. Tests if two strings are equal. Case-sensitive. The left and right values are converted to strings if they are not strings already. This operator should only be used if string comparisons need to be case-sensitive. Testing boolean with "$Value == TRUE" will only match, if the $Value really is TRUE, not just different from FALSE / 0, as "=" does. Never mind, just my 2 cent 😉 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
jchd Posted March 31, 2020 Share Posted March 31, 2020 (edited) 34 minutes ago, rudi said: Testing boolean with "$Value == TRUE" will only match, if the $Value really is TRUE, This is a direct, obvious consequence of what's already stated just above in the help file as it is right now: 34 minutes ago, rudi said: The left and right values are converted to strings if they are not strings already. Assuming $value = (1 = 1), that is $value = True, we get: VarGetType($Value) : 'Bool' which implies that it has to be converted to a string String($Value) -> 'True' Same for the boolean constant TRUE: String(TRUE) -> 'True' So your comparison boils down to: 'True' == 'True' which is trivially True. I don't see what's unclear in the current statement about == Edited March 31, 2020 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
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