{
  "format": "tokbit",
  "version": 1,
  "name": "Factorials 1 to 10",
  "main": [
    {
      "id": "u4",
      "kind": "for",
      "variable": "k",
      "range": "1, 11",
      "body": [
        {
          "id": "u5",
          "kind": "output",
          "values": "str(k) + \"! =\", factorial(k)"
        }
      ]
    }
  ],
  "functions": [
    {
      "name": "factorial",
      "params": [
        {
          "name": "n",
          "type": "int"
        }
      ],
      "returnType": "int",
      "blocks": [
        {
          "id": "u1",
          "kind": "if",
          "condition": "n <= 1",
          "then": [
            {
              "id": "u2",
              "kind": "return",
              "value": "1"
            }
          ],
          "else": [
            {
              "id": "u3",
              "kind": "return",
              "value": "n * factorial(n - 1)",
              "comment": "The function calls itself with a smaller n until it reaches 1."
            }
          ]
        }
      ],
      "comment": "Recursion: n! = n · (n − 1)!, and 0! = 1! = 1."
    }
  ],
  "comment": "Solution to the task “Every factorial”: Print the factorials of all numbers from 1 to 10, not just every fifth. What do you change in the loop range?"
}
