{
  "id": "programming.functions.print-is-return",
  "uri": "https://open-misconceptions.github.io/miscon-data/m/programming.functions.print-is-return",
  "uuid": "c75e0b4a-c9c4-41af-af83-a095635ace63",
  "version": "0.1.1",
  "status": "draft",
  "trust": "low",
  "title": "Printing a value is the same as returning it",
  "statement": "A function gives its result back by printing it, so a function that prints its answer can be used in an expression, and return is just another way to display.",
  "kind": "misapplied-analogy",
  "domain": "programming.functions",
  "about": [
    {
      "scheme": "Miscon",
      "uri": "https://open-misconceptions.github.io/miscon-data/c/programming.functions.return"
    }
  ],
  "level_band": [
    "secondary",
    "undergraduate"
  ],
  "locale": "en",
  "evidence_patterns": [
    {
      "item_shape": "use the result of a function that prints instead of returning",
      "signature": "expects the printed value to be available to the caller",
      "example": {
        "item": "def double(n):\n    print(n * 2)\nx = double(4)\nprint(x + 1)",
        "expected": "8 then TypeError (x is None)",
        "response": "9"
      }
    },
    {
      "item_shape": "write a function that should return a value",
      "signature": "prints the value and omits return",
      "example": {
        "item": "Write square(n) so that square(3) + 1 is 10.",
        "expected": "def square(n):\n    return n * n",
        "response": "def square(n):\n    print(n * n)"
      }
    }
  ],
  "discriminators": {
    "vs_slip": "A slip is one missing return the learner spots on rereading. The belief is a stated equivalence ('print gives it back') and persists after seeing None."
  },
  "relations": {
    "conflicts_with": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.functions.return",
        "label": "return hands a value back to the caller and ends the call"
      }
    ],
    "resolved_by": [
      {
        "external": "https://open-misconceptions.github.io/miscon-data/c/programming.functions.return",
        "label": "return hands a value back to the caller and ends the call"
      }
    ]
  },
  "provenance": {
    "sources": [
      {
        "type": "book",
        "citation": "Sorva, J. (2012). Visual Program Simulation in Introductory Programming Education (Doctoral dissertation, Aalto University). Appendix A catalogues introductory programming misconceptions from the literature.",
        "url": "https://aaltodoc.aalto.fi/handle/123456789/3534",
        "note": "Catalogue entry on confusing output with return values."
      },
      {
        "type": "paper",
        "citation": "Kaczmarczyk, L. C., Petrick, E. R., East, J. P., & Herman, G. L. (2010). Identifying student misconceptions of programming. In Proceedings of the 41st ACM Technical Symposium on Computer Science Education (SIGCSE '10), 107-111.",
        "doi": "10.1145/1734263.1734299"
      },
      {
        "type": "paper",
        "citation": "Qian, Y., & Lehman, J. (2017). Students' misconceptions and other difficulties in introductory programming: A literature review. ACM Transactions on Computing Education, 18(1), Article 1.",
        "doi": "10.1145/3077618"
      }
    ],
    "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"
}
