My Brain Is Hard-Wired Against ==; Help Me, Julia

Yes, I use this type of assignment all the type, mostly within while loops where I like to mutate the state:

i=0
while (i = i +1) <= length(lst)
    if dotest(lst[i]) pop!(lst, i) end
end

This isn’t the best example but with something like parsing tokens, you can easily have some forward-looking logic within that loop that also mutates your list. Sometimes you even want to mutate the list at a location <i then you just have to increase/decrease i if you removed or added an item.

1 Like