nexusmusic
nexusmusic

Reputation: 19

Can I use the OR operator or AND operator between two if..else statement?

Can/Should I use the OR operator or AND operator between two if..else statement?

If [statement]

end if

OR

If [statement]

end if

Upvotes: 1

Views: 78

Answers (1)

zedfoxus
zedfoxus

Reputation: 37119

Combine them into one statement like this:

if age < 30 AND height_feet > 6.1 then
    ' do something
else
    ' do something else
end if

If you have to check the OR condition, just switch the AND to OR.

EDIT

You can combine if statements like this also:

if age < 30 AND height_feet > 6.1 then
    ' do something
else if age < 30 OR height_feet > 6.1 then
    ' do something
else
    if employee_type = 1 then 
        ' do something
    else
        ' do something
    end if
end if

Upvotes: 1

Related Questions