My vote is for keeping '='.
It is very readable for counters as is 'in' for other containers.

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.

It is not even a documentation issue, 
the documentation is already crystal clear:

"In general, the for loop construct can iterate over any container. 
In these cases, the alternative (but fully equivalent) keyword in is 
typically used
instead of =, since it makes the code read more clearly"

On Tuesday, October 27, 2015 at 10:55:23 PM UTC+1, Hai Nguyen wrote:
>
>
>
> On Tue, Oct 27, 2015 at 10:04 AM, Stefan Karpinski <ste...@karpinski.org 
> <javascript:>> wrote:
>
>> My general approach is to only use = when the RHS is an explicit range, 
>> as in `for i = 1:n`. For everything else I use `for i in v`. I would be ok 
>> with dropping the = syntax at some point, but it seems pretty harmless to 
>> have it.
>>
>>
> I have 1 vote for removing '='. It is harmless but it introduces confusion.
>
> Hai
>  
>
>> On Tue, Oct 27, 2015 at 8:56 AM, FANG Colin <coli...@gmail.com 
>> <javascript:>> wrote:
>>
>>> Thank you. In that case I will happily stick with `in`.
>>>
>>>
>>> On Monday, October 26, 2015 at 8:43:22 PM UTC, Alireza Nejati wrote:
>>>>
>>>> There is no difference, as far as I know.
>>>>
>>>> '=' seems to be used more for explicit ranges (i = 1:5) and 'in' seems 
>>>> to be used more for variables (i in mylist). But using 'in' for everything 
>>>> is ok too.
>>>>
>>>> The '=' is there for familiarity with matlab. Remember that julia's 
>>>> syntax was in part designed to be familiar to matlab users.
>>>>
>>>> On Tuesday, October 27, 2015 at 8:26:07 AM UTC+13, FANG Colin wrote:
>>>>>
>>>>> Hi All
>>>>>
>>>>> I have got a stupid question:
>>>>>
>>>>> Are there any difference in "for i in 1:5" and "for i = 1:5"?
>>>>>
>>>>> Does the julia community prefer one to the other? I see use of both in 
>>>>> the documentations and source code.
>>>>>
>>>>> Personally I haven't seen much use of "for i = 1:5" in other 
>>>>> languages.
>>>>>
>>>>> Thanks.
>>>>>
>>>>
>>
>

Reply via email to