November 2017
Beginner
316 pages
6h 40m
English
A composite type is a collection of named fields, which can be treated as a single value. We can quickly define a composite type as:
julia> type Points x :: Int64 y :: Int64 z :: Int64 end
We have already covered the usage in the previous section. By mutable, we mean that the fieldnames type, once assigned, can be changed and reassigned to some new value, other than the one used while creating the object. This can be understood by the example given as follows:
julia> struct Point x::Int y::Int z::Int endjulia> p = Point(1,2,3)Point(1, 2, 3)julia> p.x = 10ERROR: type Point is immutable
We see that we were not able to change the values of x, y, and z once they were assigned at the time of object creation. The ERROR: type Point ...
Read now
Unlock full access