{
  "format": "tokbit",
  "version": 1,
  "name": "Poslední výskyt",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "cisla",
      "type": "list[int]",
      "init": "[4, 8, 15, 16, 23, 42, 8, 4]"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "hledane",
      "type": "int"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "pozice",
      "type": "int",
      "init": "-1"
    },
    {
      "id": "u4",
      "kind": "declare",
      "name": "i",
      "type": "int",
      "init": "len(cisla) - 1",
      "comment": "Začne posledním indexem a jde k začátku."
    },
    {
      "id": "u5",
      "kind": "output",
      "values": "\"Seznam:\", cisla"
    },
    {
      "id": "u6",
      "kind": "input",
      "target": "hledane",
      "prompt": "Hledané číslo:"
    },
    {
      "id": "u7",
      "kind": "while",
      "condition": "i >= 0 and pozice == -1",
      "body": [
        {
          "id": "u8",
          "kind": "if",
          "condition": "cisla[i] == hledane",
          "then": [
            {
              "id": "u9",
              "kind": "assign",
              "target": "pozice",
              "value": "i"
            }
          ],
          "else": []
        },
        {
          "id": "u10",
          "kind": "assign",
          "target": "i",
          "value": "i - 1"
        }
      ]
    },
    {
      "id": "u11",
      "kind": "if",
      "condition": "pozice == -1",
      "then": [
        {
          "id": "u12",
          "kind": "output",
          "values": "\"Číslo\", hledane, \"v seznamu není.\""
        }
      ],
      "else": [
        {
          "id": "u13",
          "kind": "output",
          "values": "\"Poslední výskyt na pozici\", pozice"
        }
      ]
    }
  ],
  "functions": [],
  "comment": "Řešení úlohy „Poslední výskyt“: Najdi poslední výskyt čísla místo prvního. Stačí procházet seznam od konce.",
  "screen": "fit"
}
