You are right, it only "really" applies to indexing (and related)... but that's kind of the point. There are only a select number of cases where the "=" is more natural, but it is definitely more natural in those situations. More generally, if you're wanting a simple counter to make the code do something N times, then "for x=1:N" feels much more natural than "for x in 1:N".
I'm also not clear on what you're calling a metaphor. The two pieces of code I provided do exactly the same thing (the only difference is the order of operations, but it's doing the same thing). On Wednesday, 28 October 2015 23:08:05 UTC+10, feza wrote: > > I don't think that this metaphor is actually relevant: > > i=1:5 > A[i]=B[i].*C[i] > > or, you could write it as a loop... > > for i=1:5 > A[i]=B[i]*C[i] > end > > since the `for` changes meaning completely > i = 1:10 > a[i] = b[i].*c[i] > > and the above only makes sense when indexing, not for other iterables >