Jump to content

Recommended Posts

Posted

... 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

 

Posted

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.

Posted

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

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...