Stage 2 — reporting which rule fired SASamPriceOP 11 Oct, 08:03 edited How do I show "(battery and contact)" when both are true?
EMEmmaCodes11 Oct, 11:01replies: 2Check the combined case first (both true), then each one alone, then the OFF case. Having low_battery and lost_contact as separate variables makes the conditions very readable.
OLOllieGrant11 Oct, 14:06Named booleans are such a readability win. if low_battery and lost_contact reads like English.
Comments 4
Join the discussion CommentAlready have an account? Log in
Check the combined case first (both true), then each one alone, then the OFF case. Having
low_batteryandlost_contactas separate variables makes the conditions very readable.Order matters again, like in the alert levels.
I started using this pattern at work. Code reviews got easier.
Named booleans are such a readability win.
if low_battery and lost_contactreads like English.