From c1c2a69b824e7e4be91bab9bf53f9a54f7152515 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Thu, 6 Oct 2022 10:23:59 -0400 Subject: [PATCH] Doctest for setindex (#47072) --- base/array.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/base/array.jl b/base/array.jl index 3a38632220bf6..f054bd62cfac6 100644 --- a/base/array.jl +++ b/base/array.jl @@ -951,6 +951,18 @@ end Store the given value at the given key or index within a collection. The syntax `a[i,j,...] = x` is converted by the compiler to `(setindex!(a, x, i, j, ...); x)`. + +# Examples +```jldoctest +julia> a = Dict("a"=>1) +Dict{String, Int64} with 1 entry: + "a" => 1 + +julia> setindex!(a, 2, "b") +Dict{String, Int64} with 2 entries: + "b" => 2 + "a" => 1 +``` """ function setindex! end