File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1419,8 +1419,20 @@ kw"struct"
1419
1419
mutable struct
1420
1420
1421
1421
`mutable struct` is similar to [`struct`](@ref), but additionally allows the
1422
- fields of the type to be set after construction. See the manual section on
1423
- [Composite Types](@ref) for more information.
1422
+ fields of the type to be set after construction.
1423
+
1424
+ Individual fields of a mutable struct can be marked as `const` to make them immutable:
1425
+
1426
+ ```julia
1427
+ mutable struct Baz
1428
+ a::Int
1429
+ const b::Float64
1430
+ end
1431
+ ```
1432
+ !!! compat "Julia 1.8"
1433
+ The `const` keyword for fields of mutable structs requires at least Julia 1.8.
1434
+
1435
+ See the manual section on [Composite Types](@ref) for more information.
1424
1436
"""
1425
1437
kw " mutable struct"
1426
1438
You can’t perform that action at this time.
0 commit comments