The thing is, it IS an assignment that's going on. In the case of a range, 
especially, "for i=1:5" says "loop 5 times, with i=1, then i=2, then i=3, 
then i=4, then i=5". "i' is being assigned to on each iteration. Think of 
it this way - suppose you were using elementwise operations. You could write

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

The two pieces of code are doing exactly the same thing; one is just 
explicitly writing the loop. In what way does restricting to "in" help, in 
this situation?

On Wednesday, 28 October 2015 17:56:44 UTC+10, DNF wrote:
>
> On Wednesday, October 28, 2015 at 7:56:54 AM UTC+1, Gabor wrote:
>>
>> Confusion?
>> Considering the investment into learning all the new and powerful Julia 
>> language constructs,
>> I don't see why exactly this elegant duality would be a problem for 
>> anyone.
>>
>
> I don't think = and in represent an elegant duality. They seem a very odd 
> couple to me (even though I have been using = in Matlab for 15 years.) On 
> the other hand, = and ∈ do seem to offer an elegant duality, since they 
> are already synonyms in other contexts. The concept of 'in' also seems more 
> logical than '=', which is an assignment operator.
>
> One advantage of = over 'in' is that it sticks out more visually. That is 
> solved by ∈, though.
>

Reply via email to