Tin

Examples · learn/05-structs · 111 of 339

task-1.solution

examples/learn/05-structs/task-1.solution.tintin run examples/learn/05-structs/task-1.solution.tin
type Rect = { width: float, height: float }

fn Rect.perimeter(r: Rect): float => 2.0 * (r.width + r.height)

fn main() {
  let r = Rect { width: 2.5, height: 4.0 }
  print(r.perimeter())
}