{
  "id": "programming.booleans.must-compare-with-literal",
  "uri": "https://open-misconceptions.github.io/miscon-data/m/programming.booleans.must-compare-with-literal",
  "uuid": "1e4090f5-0d1e-4bf3-af12-7671e11aaf09",
  "version": "0.1.1",
  "status": "draft",
  "trust": "low",
  "title": "A boolean must be compared with true to be used as a condition",
  "statement": "A boolean variable or expression cannot be used directly as a condition; it has to be compared with true or false first, and a comparison is the only thing that produces a condition.",
  "kind": "undergeneralization",
  "domain": "programming.boolean",
  "about": [
    {
      "scheme": "Miscon",
      "uri": "https://open-misconceptions.github.io/miscon-data/c/programming.booleans.expression"
    }
  ],
  "level_band": [
    "secondary",
    "undergraduate"
  ],
  "locale": "en",
  "evidence_patterns": [
    {
      "item_shape": "write a condition from a boolean variable",
      "signature": "writes == true (or == True) and cannot explain what if done: alone would do",
      "example": {
        "item": "done is a boolean. Write the condition for 'if done'.",
        "expected": "if done:",
        "response": "if done == True:"
      },
      "notes": "The == True form runs correctly, so this is only diagnosable by asking, or from a follow-up item."
    },
    {
      "item_shape": "return a boolean from a comparison",
      "signature": "wraps the comparison in if/else returning literal true and false",
      "example": {
        "item": "Return whether n is even.",
        "expected": "return n % 2 == 0",
        "response": "if n % 2 == 0:\n    return True\nelse:\n    return False"
      }
    }
  ],
  "discriminators": {
    "vs_slip": "A slip is a stylistic habit the learner can drop when asked. The belief is the claim that if done: is invalid or that a comparison is not a value."
  },
  "relations": {
    "conflicts_with": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.booleans.expression",
        "label": "A boolean expression is itself a value"
      }
    ],
    "resolved_by": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.booleans.expression",
        "label": "A boolean expression is itself a value"
      }
    ]
  },
  "alignments": [
    {
      "scheme": "progmiscon",
      "code": "Java/ComparisonWithBooleanLiteral",
      "uri": "https://progmiscon.org/misconceptions/Java/ComparisonWithBooleanLiteral",
      "relation": "close-match"
    },
    {
      "scheme": "progmiscon",
      "code": "Python/ComparisonWithBoolLiteral",
      "uri": "https://progmiscon.org/misconceptions/Python/ComparisonWithBoolLiteral",
      "relation": "close-match"
    },
    {
      "scheme": "progmiscon",
      "code": "Python/MapToBooleanWithIf",
      "uri": "https://progmiscon.org/misconceptions/Python/MapToBooleanWithIf",
      "relation": "close-match"
    }
  ],
  "provenance": {
    "sources": [
      {
        "type": "inventory",
        "citation": "Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386.",
        "doi": "10.1145/3430665.3456343",
        "url": "https://progmiscon.org/",
        "note": "Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently."
      }
    ],
    "origin": "llm-drafted",
    "notes": "Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review."
  },
  "history": {
    "changelog": [
      {
        "version": "0.1.1",
        "date": "2026-09-05",
        "change": "Schema 0.2 migration: about/alignments carry a free-string scheme (corestandards.org URLs relabelled CCSS where present); trust computed from reviews[] (none yet, so low); no change to the statement or evidence."
      }
    ]
  },
  "license": "CC-BY-4.0"
}
