Jump to content
Sign in to follow this  
TIapko

I need quick answer about "!=" equivalent code

Recommended Posts

TIapko

In C i use "!=" how is equivalent at au3 ?

while $a != 5

DOIT()

WEnd

Edited by TIapko

Share this post


Link to post
Share on other sites
monoceres

While Not $a = 5
   ; DOIT()
 WEnd

Missed code tag.

No, you're wrong.

while $a <> 5 
    DOIT() 
    WEnd

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Valik

While Not $a = 5
  ; DOIT()
 WEnd

Missed code tag.

Totally wrong. That code is:

While (Not $a) = 5

Where Not $a evaluates to either True or False.

Edited by Valik
Fixed post due to broken autoit tags.

Share this post


Link to post
Share on other sites
TIapko

10x so much :)

Share this post


Link to post
Share on other sites
jvanegmond

Technically, (not $a == 5) would be more like C if you know that $a is a variant.

Discuss.

Share this post


Link to post
Share on other sites
Valik

Technically, (not $a == 5) would be more like C if you know that $a is a variant.

Discuss.

I fail to see what further misinformation achieves. This is the exact same answer James gave and is the wrong answer.

Share this post


Link to post
Share on other sites
jvanegmond

Seeing as your tags now read "While (Not $a) = 5oÝ÷ Ùhbr¬èr·¬¦§µçhºØ¬ë-jëh×6While $a <> 5" the discussion was hard to follow.

More correct would be: While (Not ($a == 5)).

Share this post


Link to post
Share on other sites
Valik

Seeing as your tags now read "While (Not $a) = 5oÝ÷ Ùhbr¬èr·¬¦§µçhºØ¬ë-jëh×6While $a <> 5" the discussion was hard to follow.

Fixed.

More correct would be: While (Not ($a == 5)).

No, more correct would be While $a <> 5. Your code needless uses parenthesis for grouping (The outer pair). Then it needlessly performs an equality comparison and then inverts the result. Why do all that in so many steps and cause so much extra parsing to be involved when you can just use <> and get it all done in one go? That's like using this code to test for greater-than-or-equal:

If Not ($a < 3) Then

Share this post


Link to post
Share on other sites
jvanegmond

Damn, I thought I could remember doing a test with the == operator once. I repeated that test and different results came out from what I had remembered. I "assumed" that: 5 == "5" returned false. Which is not the case. Sorry to bother.

Share this post


Link to post
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
Sign in to follow this  

×