We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55b1230 commit 4793e88Copy full SHA for 4793e88
base/docs/helpdb/Base.jl
@@ -15,6 +15,29 @@ systemerror
15
Fill array `A` with the value `x`. If `x` is an object reference, all elements will refer to
16
the same object. `fill!(A, Foo())` will return `A` filled with the result of evaluating
17
`Foo()` once.
18
+
19
+```jldoctest
20
+julia> A = zeros(2,3)
21
+2×3 Array{Float64,2}:
22
+ 0.0 0.0 0.0
23
24
25
+julia> fill!(A, 2.)
26
27
+ 2.0 2.0 2.0
28
29
30
+julia> a = [1, 1, 1]; A = fill!(Vector{Vector{Int}}(3), a); a[1] = 2; A
31
+3-element Array{Array{Int64,1},1}:
32
+ [2,1,1]
33
34
35
36
+julia> x = 0; f() = (global x += 1; x); fill!(Vector{Int}(3), f())
37
+ 1
38
39
40
+```
41
"""
42
fill!
43
0 commit comments