Jump to content

Boolean vs Int


trancexx
 Share

Recommended Posts

I'm getting different return types depending on what I'm running, beta (3.2.13.8 - yeah I know) or stable (3.2.12.1) version.

This code demonstrates the difference:

ConsoleWrite((((1 > 5) & 1) = 1) & @CRLF)

Problem is that I can't find the change to be documented. Is it me or is it not?

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I'm getting different return types depending on what I'm running, beta (3.2.13.8 - yeah I know) or stable (3.2.12.1) version.

This code demonstrates the difference:

ConsoleWrite((((1 > 5) & 1) = 1) & @CRLF)

Problem is that I can't find the change to be documented. Is it me or is it not?

The behavior was fixed in 3.2.13.8:

- Fixed #589: Some comparison operators did not return a boolean value.

In 3.2.12.1, (1 > 5) = 0 (not a boolean variant)

Because of that, ((1 > 5) & 1) = 01 (string variant)

When you do "01" = 1, the string is run through Number() and (1 = 1) = True.

After the fix in 3.2.13.8, (1 > 5) = False (Boolean variant, converted to string on display)

Because of that, ((1 > 5) & 1) = False1 (string variant)

When you do "False1" = 1, the string is run through Number() and returns 0 because there are non-numeric characters, so (0 = 1) = False.

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The behavior was fixed in 3.2.13.8:

In 3.2.12.1, (1 > 5) = 0 (not a boolean variant)

Because of that, ((1 > 5) & 1) = 01 (string variant)

When you do "01" = 1, the string is run through Number() and (1 = 1) = True.

After the fix in 3.2.13.8, (1 > 5) = False (Boolean variant, converted to string on display)

Because of that, ((1 > 5) & 1) = False1 (string variant)

When you do "False1" = 1, the string is run through Number() and returns 0 because there are non-numeric characters, so (0 = 1) = False.

:mellow:

Ok, thanks for clarifying that.

Does this mean that Is... functions (IsInt(), IsNum()...) will be modified to return True/False in future (near one)?

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Ok, thanks for clarifying that.

Does this mean that Is... functions (IsInt(), IsNum()...) will be modified to return True/False in future (near one)?

As far as I know the functions that are explicitly described as returning 1 or 0 will continue to return an integer type.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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