You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Existence of a particular value
To find out whether an array has a particular value among its elements, you can use in():
julia> in(2, primes)
true
Somewhat strangely, in the in() syntax, the needle comes before the haystack, i.e. in(value, array), where value denotes the value you are looking for.
Why not talk about contains() as well, where the haystack comes first?
The text was updated successfully, but these errors were encountered:
Change values
To change a value, access it via the bracket syntax, then assign it the new value:
julia> statisticians["Kendall"] = "1907-1983"
"1907-1983"
julia> statisticians
Dict{ASCIIString,ASCIIString} with 4 entries:
"Galton" => "1822-1911"
"Pearson" => "1857-1936"
"Kendall" => "1907-1983"
"Gosset" => "1876-1937"
The example doesn't fit the previous contents of the Dict: you should be assigning "Gosset".
This is because dicts are not indexable, therefore there is no ordering that would make inherent sense. However, sometimes, we like dictionaries sorted. Disappointingly, sorting dicts is not as easy as sorting arrays:
Why not talk about
contains()
as well, where the haystack comes first?The text was updated successfully, but these errors were encountered: