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 @@ -1451,8 +1451,20 @@ kw"struct"
1451
1451
mutable struct
1452
1452
1453
1453
`mutable struct` is similar to [`struct`](@ref), but additionally allows the
1454
- fields of the type to be set after construction. See the manual section on
1455
- [Composite Types](@ref) for more information.
1454
+ fields of the type to be set after construction.
1455
+
1456
+ Individual fields of a mutable struct can be marked as `const` to make them immutable:
1457
+
1458
+ ```julia
1459
+ mutable struct Baz
1460
+ a::Int
1461
+ const b::Float64
1462
+ end
1463
+ ```
1464
+ !!! compat "Julia 1.8"
1465
+ The `const` keyword for fields of mutable structs requires at least Julia 1.8.
1466
+
1467
+ See the manual section on [Composite Types](@ref) for more information.
1456
1468
"""
1457
1469
kw " mutable struct"
1458
1470
You can’t perform that action at this time.
0 commit comments