Reputation: 85
what does exactly the following lines in Julia?
for i in range(1,length=length(parameterList))
parameterList[i]["alfa"]= measures_list[i]
end
does it put, like in Java, or something different?
Upvotes: 1
Views: 58
Reputation: 69949
This line means that most likely each entry of parameterList
is a dictionary. Then in each of these dictionaries key "alfa"
is assigned value measures_list[i]
.
Other ways to write it not using range
are for example:
for i in eachindex(parameterList)
parameterList[i]["alfa"]= measures_list[i]
end
or
for (i, parameter) in enumerate(parameterList)
parameter["alfa"]= measures_list[i]
end
or
foreach(parameterList, measure_list) do parameter, measure
parameter["alfa"]= measure
end
or if you are sure that parameterList
and measures_list
have the same length:
for (parameter, measure) in zip(parameterList, measure_list)
parameter["alfa"]= measure
end
(choose whatever you like best :))
Upvotes: 1