Validating two variables (nested conditionals?)

Yes, of course, you can write such a condition.