Results 1 to 4 of 4

Thread: using AND and OR in the same IF?

  1. #1
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5

    using AND and OR in the same IF?

    I use my script like this:

    PHP Code:
    if windowcount 2 then
    if energized or burning then
    gotolabel
    ("depot")
    end
    end 
    I'd like to know if it is possible to use AND and OR in the same IF, like:

    PHP Code:
    if windowcount and (energized or burningthen
    gotolabel
    ("depot")
    end 
    Thanks in advance.

  2. #2
    iBot User
    Join Date
    Jun 2012
    Posts
    517
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    4 Post(s)
    Reputation
    132
    Rep Power
    7
    Quote Originally Posted by john86 View Post
    I use my script like this:

    PHP Code:
    if windowcount 2 then
    if energized or burning then
    gotolabel
    ("depot")
    end
    end 
    I'd like to know if it is possible to use AND and OR in the same IF, like:

    PHP Code:
    if windowcount and (energized or burningthen
    gotolabel
    ("depot")
    end 
    Thanks in advance.
    If (energized or burning) 1 of these will be true then the () will all will be true else if both will be false then the () will be false so yes you can use "AND and OR in the same IF"

  3. #3
    Banned
    Join Date
    May 2012
    Posts
    1,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    127
    Rep Power
    0
    if windowcount() > 2 and (energized or burning) then
    gotolabel("depot")
    end


    Should be fine

  4. #4
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •