Hello,

The following code runs for iteration 1, printing the “mindi” variable. However, it throws an error for iteration 2. It says mindi is undefined. Why is the variable inaccessible for the second iteration?

```
maxiter = 10000
tol = .00000001
iter = 1 #initalize iterator
maxdi = 1000 #initalize difference, arbitrary large number
v = zeros(nz,nk)
while ((iter < maxiter) & (maxdi > tol));
q = P*v;
qlong = fillin(q)
#first iteration use full bellman, then limit
if iter < 2
res = maxbellman(qlong)
else
print(iter)
res = mc_maxbellman(qlong,maxdi,mindi)
end
maxdi = findmax(abs.(res.v - v))[1];
mindi = findmin(abs.(res.v - v))[1];
global v = res.v
global l = res.k
iter = iter + 1
println(maxdi)
println(mindi)
end;
```