@jamblejoe wrote:
Is it possible to return an outer function from a do block, e.g. the following code
f(x) = map(x) do y; if y==1; return -1; end; x *=2; end f([1,2])
evaluates to
2-element Array{Int64,1}: -1 4
I guess this is because the
do
block is creating an anonymous function, in which the return then gets evaluated. Is it possible to return from the enclosing function f and return just
-1
? Maybe that is not useful/possible formap
but I would find this very handy for loading files withopen
orh5open
.Best,
Jamble
Posts: 6
Participants: 4