Modify

Opened 10 years ago

Closed 10 years ago

#2621 closed Bug (No Bug)

Problem comparing strings

Reported by: diegomainster@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.10.2 Severity: None
Keywords: Cc:

Description

Hello, in version 3.3.10.2, I have to put the strings to be compared between parentheses, I think it's a bug, because in version 3.3.8.1, I do not have to do that. This problem only occurs when using the "Not".

$str = 'TEXT'

If Not StringLeft($str, 2) = 'M_' Then
	MsgBox(0, 'without brackets', 'OK')
Else
	MsgBox(16, 'without brackets', 'Error')
EndIf

If Not (StringLeft($str, 2) = 'M_') Then ; if I put in brackets, compare properly
	MsgBox(0, 'with brackets', 'OK')
Else
	MsgBox(16, 'with brackets', 'Error')
EndIf

Attachments (0)

Change History (2)

comment:1 Changed 10 years ago by guiness

This has always been the case when using Not. No Bug.

comment:2 Changed 10 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

Please read Operators page, You will see that Not opetator has a higher precedence that =
so your expression is executed as (Not string1) = string2

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.