Slow to learning newer julia syntax and scoping.
In Julia v1.1.1
what is the explanation for why the MWE below throws error "ff not defined" ?
N = 5;
typp = "b";
mu = 2;
function bigfun()
function f(u,mu)
ee = mu*u;
return ee
end
function g(uv,mu)
ee = (mu^2)*uv
return ee;
end
while 1 == 1
u = ones(N);
if typp == "a"
ff(u) = f(u,mu);
elseif typp == "b"
ff(u) = g(u,mu);
end
fu = ff(u);
break;
end
end
bigfun();
N
,typp
,mu
), which is bad for performance, and a bad idea in general. You should avoid that. (A style tip: usewhile true
instead ofwhile 1 == 1
.) – DNFconst
if you really want a global variable. – giordano