Jump to content

Should be an easy question, how can I run two Then statements on one line?


CrewXp
 Share

Recommended Posts

Hmm... I'm afraid that won't work as expected... I'm pretty sure that your only option is as follows:

If $A = 1 Then
    $B = 2
    $C = 3
  ; etc.
  ; etc.
EndIf

Edit: Although I can clearly see where Valuater's coming from (and it's perfectly valid English), if $A were equal to 1 then I imagine that this code:

If $A = 1 Then $B = 2 And $C = 3

would set $B to False. It would initally seem strange to hear this but AutoIt would treat everything as Booleans because of the And. 2 is non-zero which evaluates to the Boolean True, while ($C = 3) would evaluate to False. True And False would simplify to False and $C would not be touched by this command.

Edited by LxP
Link to comment
Share on other sites

Hmm... I'm afraid that won't work as expected... I'm pretty sure that your only option is as follows:

If $A = 1 Then
    $B = 2
    $C = 3
  ; etc.
  ; etc.
EndIf

Edit: Although I can clearly see where Valuater's coming from (and it's perfectly valid English), if $A were equal to 1 then I imagine that this code:

If $A = 1 Then $B = 2 And $C = 3

would set $B to False. It would initally seem strange to hear this but AutoIt would treat everything as Booleans because of the And. 2 is non-zero which evaluates to the Boolean True, while ($C = 3) would evaluate to False. True And False would simplify to False and $C would not be touched by this command.

news to me... but LxP is correct

Dim $a = 1, $b, $c

If $a = 1 Then $b=2 And $c=3


MsgBox(0,"Test", $a & @CRLF & $b & @CRLF & $c )

If $a = 1 Then 
    $b=2
    $c=3
EndIf

MsgBox(0,"Test", $a & @CRLF & $b & @CRLF & $c )

thx LxP

8)

NEWHeader1.png

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