Build a full truth table for AND, OR, NOT, or a compound expression, or evaluate an if-statement condition using Python and JavaScript's operator precedence order.
You are a logic instructor who has watched students write an `if` statement with three conditions chained together by `and` and `or`, get a result that surprises them, and never realize the surprise came from operator precedence rather than from a mistake in their thinking, because `not` binds tighter than `and`, which in turn binds tighter than `or`, in nearly every mainstream language, and nobody ever pointed that rule out to them directly. Work in [MODE:select:show me a truth table,evaluate my own if-statement condition] mode. If I chose show me a truth table, my expression is [EXPRESSION?], described in plain English or written using `and`, `or`, and `not`, such as A and not B, or A or B and not C. If I left [EXPRESSION?] blank, build a truth table for a single AND, a single OR, and a single NOT as a default starting point instead. Build the complete table, listing every combination of true and false for each variable involved, and for each row, show the result of any intermediate sub-expression before showing the final result, so a compound expression's table makes visible how the pieces combine rather than only showing the final column. After the table, state in one plain-language sentence what the expression actually means in practice, such as noting that A and not B is true only when A holds and B specifically does not. If I chose evaluate my own if-statement condition, my code is: [CODE] If I left [CODE] blank, ask me to paste the actual conditional expression before doing anything else instead of inventing one. My variable values for this evaluation are [VALUES?], and if I left them blank, ask me to provide specific values for each variable in the condition, since evaluating an expression requires knowing what it is being evaluated against. Evaluate the expression step by step in the correct order of operations, resolving every `not` first, then every `and`, then every `or`, showing the intermediate boolean result after each operator is applied rather than jumping straight to a final true or false. If the expression uses parentheses to override the default order, honor that grouping explicitly and state where it changes which operation happens first compared to how the expression would evaluate without those parentheses. In either mode, if the expression as written could be simplified using a boolean identity, such as replacing "not (A and B)" with "not A or not B", mention that equivalent form as a footnote, without rewriting the original expression, since seeing that two different-looking expressions produce identical truth tables is often the moment boolean logic stops feeling like memorized syntax.
Use this prompt anywhere
10,000+ expert prompts for ChatGPT, Claude, Gemini, and wherever you use AI.
Get Early AccessA three-condition if-statement chaining and and or together produces a result that surprises a lot of beginners, and the surprise rarely comes from a mistake in their reasoning. It comes from operator precedence, not binds tighter than and, and binds tighter than or, in nearly every mainstream language, a rule rarely pointed out before someone hits it the hard way.
Truth table mode builds a complete table for AND, OR, NOT, or a compound [EXPRESSION] you describe in plain English or with and, or, and not. Every row shows intermediate sub-expression results before the final column, so a compound expression's table reveals how the pieces actually combine instead of just landing on a final answer. Evaluate mode goes the other direction, taking an actual [CODE] condition from your own if-statement plus specific [VALUES] for each variable, and resolving it step by step in the real order of operations, not first, then and, then or, with parentheses honored explicitly when they override that default order.
Either mode closes with a plain-language sentence stating what the expression actually means in practice, and flags an equivalent simplified form when one exists, without rewriting your original, since seeing two different-looking expressions produce identical truth tables is often the moment boolean logic stops feeling like memorized syntax. Run it in the Dock Editor for a reference of evaluated conditions, pair with the operator practice generator for the operators feeding these conditions, or the code explanation generator once it sits inside a larger function.
Feed this prompt to ChatGPT, Claude, or Gemini, or open it in the Dock Editor. Set [MODE] to show a truth table for AND, OR, NOT, or a compound expression, or evaluate my own if-statement condition to work through actual code.
In truth table mode, describe [EXPRESSION] in plain English or with and, or, not. In evaluate mode, paste your actual conditional into [CODE].
In evaluate mode, supply [VALUES] for each variable in your condition so the expression can actually be resolved against real inputs.
See not resolved first, then and, then or, with each intermediate boolean result shown before the final answer, and parentheses honored explicitly when present.
If your expression could be rewritten using a boolean identity, that equivalent form is noted as a footnote without altering your original expression.
Build truth tables for AND, OR, NOT, and compound expressions to see exactly how each combination of true and false values produces the final result.
Paste your actual condition and variable values and get it evaluated step by step in the real order of operations, revealing whether operator precedence explains the surprise.
Work through a multi-condition if-statement with several and and or operators chained together, seeing exactly which sub-expression resolves first.
Practice building truth tables for compound expressions and evaluating real conditionals ahead of a test covering boolean logic and control flow.
Discover more prompts that could help with your workflow.
Build a small working program that calls a real public API, with the request, response, and API key setup explained step by step.
Explain a core functional programming idea, such as pure functions or immutability, with a broken code example and its fixed version shown side by side.
Explain a built-in math function, square root, power, absolute value, or rounding, covering math and syntax, then generate practice calls to predict before revealing results.
10,000+ expert-curated prompts for ChatGPT, Claude, Gemini, and wherever you use AI. Our extension helps any prompt deliver better results.