9 - Structs in Julia Flashcards
Introduction to Julia
What is the basic structure of a struct?
Introduction to Julia
How can you create an object using a struct?
Introduction to Julia
How do you call the fields from a struct object?
Introduction to Julia
Are structs mutable or immutable?
immutable
Introduction to Julia
Is it possible for a struct to be mutable?
Yes, with the mutable keyword.
Introduction to Julia
Is it possible to restrict the data types that can be used in a struct?
Yes, use ‘ :: ‘
Introduction to Julia
How can the field of a mutable struct be changed?
Introduction to Julia
With a mutable struct, what happens if you do not use the correct field type?
Introduction to Julia
Can a mutable struct have a custom constructor?
Yes
Introduction to Julia
What is necessary for a constructor?
The ‘new’ keyword
Introduction to Julia
How can a mutable struct be used with a function?