water Posted June 17, 2013 Share Posted June 17, 2013 ... but there is no rule for when strings are treated as numbers. It's in this sentence (taken from the help file as posted in #3): "If a string is used as a number ..." If you do a comparison using "=" and one operand is a number then the second needs to be a number too. If it is a string "an implicit call to Number() function is done" My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mwhidden Posted June 17, 2013 Author Share Posted June 17, 2013 I must respectfully disagree that the only interpretation is that the 2nd needs to be a number too. It is at least conceivable that it could have been the other way -- that when one states if("abc" = 1) that the 1 is converted to "1" as happens with the & operator, or even that it were just generally the case that strings and numbers are never (except in pathological cases) equal (ala C/C++ comparing a char* to an int with proper typecasts). Therefore, I think it is worth documenting that the authors of AutoIt chose that when comparing a number to a string that the string becomes a number, and not vice versa. Because = so naturally applies both to strings and numbers, (while, on the other hand, +, -, * are clearly numeric), it is ambigiuous in the documentation of which type takes precedence in a comparison. In fact, numbers are preferred, but the only way to learn this is to try it in code. Link to comment Share on other sites More sharing options...
water Posted June 17, 2013 Share Posted June 17, 2013 I support every effort to make the documentation as clear as possible. I see you have already posted on the help file thread. Let's see what Guinness thinks about the issue. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
AZJIO Posted June 17, 2013 Share Posted June 17, 2013 mwhidden, I will dig up a couple of links '?do=embed' frameborder='0' data-embedContent>> My other projects or all Link to comment Share on other sites More sharing options...
mwhidden Posted June 18, 2013 Author Share Posted June 18, 2013 @AZJIO, Thank you for the additional references! -mwhidden 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