diff options
author | Andrew <andrewdimola@gmail.com> | 2022-07-15 20:49:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 20:49:24 -0400 |
commit | 13743fc49a16934babe480f87d98a344201bec30 (patch) | |
tree | feae02e43f319b410a73fd899d54020bf056f929 /julia.html.markdown | |
parent | dd5c81e40d6457b650ae366ec27b265df290c82c (diff) | |
parent | 4aa0d91d1c1ea2ce63ef623999d9d5b1b053d208 (diff) |
Merge branch 'adambard:master' into update-stale-hack-docs
Diffstat (limited to 'julia.html.markdown')
-rw-r--r-- | julia.html.markdown | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/julia.html.markdown b/julia.html.markdown index 4d8eb497..336cd2b8 100644 --- a/julia.html.markdown +++ b/julia.html.markdown @@ -356,6 +356,20 @@ intersect(filledSet, otherSet) # => Set([4, 3, 5]) union(filledSet, otherSet) # => Set([4, 2, 3, 5, 6, 1]) setdiff(Set([1,2,3,4]), Set([2,3,5])) # => Set([4, 1]) +# Assignment with `=` attaches a new label to the same value without copying +a = [1, 2, 3] +b = a +# Now `b` and `a` point to the same value, so changing one affects the other: +a[3] = 5 +b[3] # => 5 + +# The `copy()` function can create a shallow copy of an array, dictionary, +# or other container +a = [1, 2, 3] +c = copy(a) +a[3] = 5 +c[3] # => 3 + #################################################### ## 3. Control Flow #################################################### |