Variables
New variables can be introduced with the let keyword:
Definitions may contain a type annotation after the identifier (let Δp: Pressure = 0.1 bar). This annotation will be verified by the type checker. For more complex definitions
it can be desirable to add type annotations, as it often improves readability and allows
you to catch potential errors early:
let μ_water: DynamicViscosity = 1 mPa·s
let Q: FlowRate = π × pipe_radius^4 × Δp / (8 μ_water × pipe_length)
Info
Variables in Numbat are immutable. Once defined, their value cannot be changed. However, you can always redefine a variable by introducing a new definition with the same name:
Here, the firstnumbers symbols has a type of String, while the second numbers has a type of List<String>.