You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the loop executes 0 times, then i should be 0; otherwise it should be greater than 0.
functioncount_and_maximum(xs)
i =0
m =0for (i, x) =enumerate(xs)
m =max(m, x)
end
(i, m)
endcount_and_maximum(1:5) # (0, 5) is returned, not the desired result.
I want to expose i outside the loop but outer doesn't work with unpacking assignment.
forouter (i, x) inenumerate(xs)
ERROR: syntax: no outer local variable declaration exists for"for outer"
for (outer i, x) =enumerate(xs)
# └──┘ ── Expected `)`
It would be nice to have some way to do this.
The text was updated successfully, but these errors were encountered:
If the loop executes 0 times, then
i
should be0
; otherwise it should be greater than0
.I want to expose
i
outside the loop butouter
doesn't work with unpacking assignment.It would be nice to have some way to do this.
The text was updated successfully, but these errors were encountered: