Jump to content

Recommended Posts

Posted

As it also says,

= Tests if two values are equal (case insensitive if used with strings). e.g. If $var= 5 Then (true if $var equals 5)

== Tests if two values are equal (case sensitive if used with strings)

So:

"Dog"="dog" is True

"Dog"=="dog" is False

Posted (edited)

sorry i may be very wrong in autoit - but in c++ and vbs '=' is an assignment to a variable , and '==' is a relational operator.

IE

'variable assignment context

a = 10

(vaue 10 is put into variable 'a')

'relational operator context

if (a==10)

Do correct me though if im wrong - im not up to speed with autoit as yet.

EDIT: As im not up tp speed you should probably not listen to me hahaha. Read above for a better informed post.

Edited by amfony
Posted

Do correct me though if im wrong - im not up to speed with autoit as yet.

It will work like you described, but not for that reason. Expressions are always rendered boolean for the if statement.

With =, AutoIt lets the context determine if an expression is an assignment or a comparison.

$var = "one" assigns "one" to $var

Consider:

ConsoleWrite((1=1)+3 & @cr)

ConsoleWrite((1=1) & 3)

Outputs:

4

True3

You'd do well to experiment a little, and read up on "Operators" in the help file. I know a lot of people don't like help files, but this is a good one - well-designed, consistant, and genuinely useful. Honestly, I wish more help files were like it!

Posted

I know a lot of people don't like help files, but this is a good one - well-designed, consistant, and genuinely useful. Honestly, I wish more help files were like it!

I couldn't agree more. The Autoit helpfile is awesome. I'm not really much of a coder, but the help file is so well written, I've hardly had to ask any questions at all, and I've been able to do some really cool stuff all on my own. :P

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
×
×
  • Create New...