Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

Find the case that breaks your boolean logic: Tangibool's free version is live

Two lines written from the same spec: // "Allow entry to members and invited guests, unless they are banned." const allowA = (member || invited) && !banned; const allowB = member || (invited && !banned); The two lines

Two lines written from the same spec:

// "Allow entry to members and invited guests, unless they are banned."
const allowA = (member || invited) && !banned;
const allowB = member || (invited && !banned);

The two lines disagree in two of the eight possible cases: a banned member, with or without an invitation. allowB lets them in.

I built Tangibool so that differences like this can't hide, and today its free version is live at https://tangibool.com/. It runs in your browser, needs no account, and includes every feature.

See the two lines above compared in the free equivalence checker, no sign-up: open the comparison. It reports Not equivalent with member = true, invited = false, banned = true.

Just finished work on the free version of Tangibool. Try it and let me know what you think!

I'd love feedback from people who write conditionals as part of the work they do. What's the gnarliest boolean condition in your codebase, and did Tangibool find anything in it? If it confused you anywhere, I want to hear that too.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.