Skip to content

Commit

Permalink
Add paragraph about creating instances (#64)
Browse files Browse the repository at this point in the history
* explain special admonitions

* add paragraph about instances
  • Loading branch information
BeastyBlacksmith authored Aug 29, 2023
1 parent ad0705b commit 60c537d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 03_Julia_type_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 60c537d

Please sign in to comment.