# [Ruby] If and else problems-with operators-

### Problem: You are a policeman. I am investigating two suspects, a and b. In both cases, if the testimony is True or False, the testimony is True. However, if either is False and True, the testimony is False, and let's create a method that outputs it using a logical operator.

** How to call: ** police_trouble(a, b)
** Output example: **

``````police_trouble(true, false) → False
police_trouble(false, false) → True
police_trouble(true, true) → True
``````

** Logical operator ** Logical operators to describe complex conditional expressions that combine two or more conditional expressions&&、||、!Is used. Use it as follows.
``````#true if both a and b are true
a && b

#true if either a or b is true
a || b

#false if a is true, true if a is false
!a
``````

``````def police_trouble(a, b)
if (a && b) || (!a && !b)
puts "True"
else
puts "False"
end
end

police_trouble(true, false)
police_trouble(false, false)
police_trouble(true, true)

``````

Logical operator in if statement&&When||When!Describe the conditional expression using a. 「(a && b) || (!a && !b)"Is ① Both a and b are true ② 　　　〃 　false In either case, "** True **" is output. Otherwise (if not meshing) output False.