diff --git a/03_Julia_type_system.jl b/03_Julia_type_system.jl index e558ebb3..d16a1059 100644 --- a/03_Julia_type_system.jl +++ b/03_Julia_type_system.jl @@ -119,6 +119,19 @@ subtypes(Real) # The correct answer is 4: # while `1` is an integer, `1.0` is a floating-point value. +# ## Instances + +# So far Melissa only defined the layout of her new types `Trebuchet` and `Environment`. +# To actually create a value of this type she has to call the so called _constructor_, which is a function with the same name as the corresponding type and as many arguments as there are fields. + +trebuchet = Trebuchet(500, 0.25pi) + +# Note, how the values will get converted to the specified field type. + +environment = Environment(5, 100) + +# `trebuchet` is being called an _instance_ or _object_ of the type `Trebuchet`. +# There can only ever be one definition of the type `Trebuchet` but you can create many instances of that type with different values for its fields. # ## Creating a subtype diff --git a/README.md b/README.md index 108e3941..d2c2cf47 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,14 @@ Assuming you are in the root of this project run: ```bash julia --project=@. generate.jl ``` + + +## special admonitions + +In this lesson we use some special admonitions to handle different question types: + +- `mc`: for multiple choice questions +- `sc`: for single choice questions +- `freetype`: for questions with a freeform answer + +In addition we always refer to other episodes with the `.ipynb` file-ending since this is the most unique of all the output formats and replace these with the correct ending in the post-processing step.