By looking at the example provided in the doc link you shared, I think you are confusing/mixing inputs and persistent values.
If you want to use a persistent value (cnt), you should define
cnt = 1;
Attached a model which shows three different examples, one with non-direct feedthrough (the output value can already affect the input value at the same sample step), and two with direct feedthrough (unit delay is required to avoid algebric loop). In the two direct feedthrough examples, note how the order of the code can affect the results.