In Julia, an exclamation mark is part of a function name and conventionally warns that the function may mutate one of its inputs. Thus, push! and push are different names; Julia provides push!, not push. section 4.7
Growing an array with push!
Create an empty array, then add values with push!: `ys = []; push!(ys, 3); push!(ys, 8)`. The same `ys` array grows after each call, making the mutation visible. section 4.7
Use the convention to make mutation easier to notice:
- Add ! to names of functions you define when they potentially modify an input. section 4.7
- Treat the mark as a readability aid: without it, every function call could require checking whether an input changes. section 4.7
push!(xs, x)
Inspect a short REPL sequence showing an array change after each push! call. section 4.7
