Jump to content

How to use "OR" (AutoIt Newbie)


Recommended Posts

Global Const $HEADER_ITEMTYPE_SKILLTOME   = 9
Global Const $HEADER_ITEMTYPE_GOLDCOINS   = 20
 
If ($itemType = $HEADER_ITEMTYPE_SKILLTOME Or
    $itemType = $HEADER_ITEMTYPE_GOLDCOINS) Then
    
    Return True

Endif

Hi guys, new AutoIt programmer here. I'm not entirely sure why I am getting the following errors . I assume its because I am using "Or" incorrectly.

Would be sweet if someone could point the issue out :)

Quote

(504,50) : error: syntax error
   If ($itemType == $HEADER_ITEMTYPE_SKILLTOME Or
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(504,50) : error: unbalanced paranthesis expression.
   If ($itemType == $HEADER_ITEMTYPE_SKILLTOME Or
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(504,50) : error: multi-line 'If' missing 'Then'.
   If ($itemType == $HEADER_ITEMTYPE_SKILLTOME Or
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(505,43) : error: syntax error
       $itemType = $HEADER_ITEMTYPE_GOLDCOINS)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(509,4) : error: syntax error
   Endif
~~~^
(509,4) : error: Statement cannot be just an expression.
   Endif

 

Link to comment
Share on other sites

Some languages allow you to continue a line like that but in AutoIt, the line continuation character is the underscore (_).  So if you wanted to break up your if statement like that, it would look like this:

Global Const $HEADER_ITEMTYPE_SKILLTOME   = 9
Global Const $HEADER_ITEMTYPE_GOLDCOINS   = 20

If ($itemType = $HEADER_ITEMTYPE_SKILLTOME Or _
    $itemType = $HEADER_ITEMTYPE_GOLDCOINS) Then

    Return True

Endif

 

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