{
  "format": "tokbit",
  "version": 1,
  "name": "Largest and smallest",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "numbers",
      "type": "list[int]",
      "init": "[3, 17, 5, 12, 9]"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "largest",
      "type": "int",
      "init": "numbers[0]"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "smallest",
      "type": "int",
      "init": "numbers[0]"
    },
    {
      "id": "u4",
      "kind": "for",
      "variable": "i",
      "range": "1, len(numbers)",
      "body": [
        {
          "id": "u5",
          "kind": "if",
          "condition": "numbers[i] > largest",
          "then": [
            {
              "id": "u6",
              "kind": "assign",
              "target": "largest",
              "value": "numbers[i]"
            }
          ],
          "else": []
        },
        {
          "id": "u7",
          "kind": "if",
          "condition": "numbers[i] < smallest",
          "then": [
            {
              "id": "u8",
              "kind": "assign",
              "target": "smallest",
              "value": "numbers[i]"
            }
          ],
          "else": [],
          "comment": "A smaller number replaces the minimum so far."
        }
      ]
    },
    {
      "id": "u9",
      "kind": "output",
      "values": "\"The largest number is\", largest"
    },
    {
      "id": "u10",
      "kind": "output",
      "values": "\"The smallest number is\", smallest"
    }
  ],
  "functions": [],
  "comment": "Solution to the task “The smallest too”: Also find the smallest number in the list and print both."
}
