# Sample Nim program — samplefiles.com import std/strformat type Customer = object id: int name: string balance: float proc isVip(c: Customer): bool = c.balance >= 10_000.0 proc totalBalance(customers: openArray[Customer]): float = for c in customers: result += c.balance let customers = [ Customer(id: 1, name: "Ada", balance: 12_500.0), Customer(id: 2, name: "Grace", balance: 830.5), Customer(id: 3, name: "Linus", balance: 10_000.0), ] for c in customers: let tag = if c.isVip: "VIP" else: "" echo &"{c.name:<6} {c.balance:>10.2f} {tag}" echo &"Total: {totalBalance(customers):.2f}"