7 Understanding types
This chapter covers
- Understanding type hierarchies
- Differences between abstract and concrete types
- Combining primitive types to make composite types
- Harnessing the power of multiple dispatch to solve complex tasks elegantly
- How multiple dispatch differs from single dispatch in object-oriented languages1
All objects in Julia are of a particular type. Remember, you can use typeof to discover the type of any object:
julia> typeof(42) Int64 julia> typeof('A') Char julia> typeof("hello") String
The type decides what you can do with an object. For example, a dictionary allows you to look up a value by key, while an array stores elements in order. An expression evaluating to a Bool value, such as true or false, can be used in ...
Get Julia as a Second Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.