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.

On Tue, Oct 27, 2015 at 8:56 AM, FANG Colin <[email protected]> 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