Jump to content

If .... then help


Recommended Posts

hi there

if you got a script like this:

$variable = 12
if 1234 = $variable then
...
endif

that does something if 1234 is the same as the variable.

But is there a way to make it do something if the variable isn't the same?

I've looked in the help file but can't find anything.

Link to comment
Share on other sites

If...ElseIf...Else...EndIf

--------------------------------------------------------------------------------

Conditionally run statements.

If <expression> Then

statements

...

[ElseIf expression-n Then

[elseif statements ... ]]

...

[Else

[else statements]

...

EndIf

Source : Autoit Helpfile ( F1 )

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

If...ElseIf...Else...EndIf

--------------------------------------------------------------------------------

Conditionally run statements.

If <expression> Then

statements

...

[ElseIf expression-n Then

[elseif statements ... ]]

...

[Else

[else statements]

...

EndIf

Source : Autoit Helpfile ( F1 )

Thanks but not what I was looking for :idea:
Link to comment
Share on other sites

But is there a way to make it do something if the variable isn't the same?

Read doc on Operators.

If 1234 <> $variable Then
If Not (1234 = $variable) Then

If IsNumber($variable) And Not($variable = 1234) Then
If IsInt($variable) And Not($variable = 1234) Then

Edit: not sure what your need, but experiment with the last two.

Thank you very much!

Just what I wanted to see :idea:

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...