let gives a value a name. Use the name when the same idea appears again.
let port := 8080;
let nextPort := port + 1;
nextPort;A private let belongs to the file. export let is like putting a label on a shelf that other files can reach.
Use short names for local steps. Use clearer names for exported values. A reader from another file only sees the exported name first.
If the value may change later, do not use plain let. Use mut so the changing place is visible.
let form
The basic form is:
let total := 42;The name goes on the left. The value-producing expression goes on the right.
let retries := 3;
let label := "ready";
let enabled : Bool := .True;Use := for binding. Use = only for comparison.
Type annotations
Add a type when it documents a boundary.
let port : Int := 8080;
let label : String := "ready";