You can do multiple assignment with anything you can iterate over on the
right hand side, in this case you could do e.g. aa, bb = 12:3:15 with the
same assignment to aa and bb. One difference is in the value of the
expression, as printed by the REPL, which coincides with the RHS but would
usually be discarded. A more interesting difference is how well the code
generation can optimize away or avoid generating temporary objects for the
RHS, in your case a tuple and an array respectively, in my example a range.
I don't have sufficiently deep insights to say something with confidence
here but in my opinion your first option is the most natural one and I'd be
surprised if any other solution would be more efficient.
Den torsdagen den 17:e april 2014 kl. 05:40:18 UTC+2 skrev K leo:
>
> Can anyone explain the difference of the following 2 ways? Which is
> more preferred?
>
> julia> aa, bb = 12, 15
> (12,15)
>
> julia> aa, bb = [12, 15]
> 2-element Array{Int64,1}:
> 12
> 15
>
>