November 2017
Beginner
316 pages
6h 40m
English
Sometimes, when defining a function in Julia, we may also include a ! (not to be confused with the Boolean operator ! for not in Julia) just after the function name. For example, in Julia, we have a function named push! whose job is to insert one or more items at the end of a collection. Representing that in code, we have:
push!(collection of items, the item you want to push to the end of collection)julia> push!([1, 2, 3], 4) 4-element Array{Int64,1}: 1 2 3 4
But what does the ! really stand for here? It is a convention which says that the function can actually mutate its input or, in other words, a function can modify its arguments. An important condition for that to happen is that inputs are mutable and should have the ability ...
Read now
Unlock full access