Sign in to follow this  
Followers 0
masonje

"not" vs "<>"

7 posts in this topic

I have seen both of these used but using "Not" just bit me in the butt. Why did:

if $clientCurUsr <> "nolog" Then
;....log
endif

;....worked...

;...and "Not" didn't....

if not $clientCurUsr = "nolog" Then
;....log
endif

I lost 2 days of logs and it's my fault for not testing, but I ASSumed the above statement worked fine.

Thanks

Jon

Share this post


Link to post
Share on other sites



But both should have ended up with the same outcome right? Why are the two statements not the same?

Share this post


Link to post
Share on other sites

But both should have ended up with the same outcome right? Why are the two statements not the same?

nope for example:

$Toggle = False

$Toggle = Not Toggle

MsgBox(0,"toggle", $Toggle)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I lost 2 days of logs and it's my fault for not testing, but I ASSumed the above statement worked fine.

if not ($clientCurUsr = "nolog") Then

endif

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

if not ($clientCurUsr = "nolog") Then

endif

Cheers

Kurt

forgot about using it that way, I try to stay away from negative evaluations tho.

Sometimes have to.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@gafrost

If you refer to negative evalutions as to being poor syntax, I totally agree.

; Good syntax (checking not condition)
If Not $condition Then

; Poor syntax (checking equal condition and then not condition)
If Not ($condition = $condition) Then

; Good syntax (checking not equal condition)
If $condition <> $condition Then

The last checks for unequal condition. The 2nd does a long way of doing the same. Checking if equal and then not in the same line is poor syntax.

:lmao:

Edited by MHz

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  
Followers 0