2 ms·
Implies is probably something you've used in a program's logic, it's probably not something you've directly programmed (in the sense that few people, outside of
by Jtsummers 6y ago
Implies is probably something you've used in a program's logic, it's probably not something you've directly programmed (in the sense that few people, outside of exercises, are going to code up logical operators). You'll see it in some conditionals. Think of the logical expression: If the radiation emitter is on then the safety door is closed.
This is not causal, we don't say that we will close the door, we are saying something that should just be true about the system (like in an assert). Perhaps if this assert fails we want the whole thing to shutdown.
Since languages like C don't have an implies operator, you'd write this assert as something like:
ASSERT(!RADIATION_EMITTER_ON || DOOR_IS_SHUT,
"Well, we irradiated something, but probably not what we wanted.")
It holds the same logical meaning (you can evaluate it by examining the truth table of A => B and ~A || B).
A B | A => B ~A || B
F F | T T
F T | T T
T F | F F
T T | T T