# How to convert Boolean predicates to numeric expressions [closed]

I'd like to use Boolean expressions as numeric values, as in:

a = 3 < 2
b = 3
a * b


but the final result of that is 3 False, instead of 0. I can do something like:

a = 3 < 2
b = 3
a * b /. False -> 0 /. True -> 1


but that seems awkward. I suppose I can make a function to do these replacements, but is there a more natural or a builtin way to do this?

## closed as off-topic by Daniel Lichtblau, ilian, m_goldberg, Michael E2, JensNov 22 '15 at 2:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, ilian, m_goldberg, Michael E2, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

• Perhaps, a = Boole[3 < 2] is what you are looking for. – m_goldberg Nov 21 '15 at 14:52
• What m_goldberg says. Your double replacement is longer than necessary BTW, and could have been written as a * b /. {False -> 0 ,True -> 1}. – Sjoerd C. de Vries Nov 21 '15 at 15:45

a = Boole[3 < 2]