Tin

Examples · learn/25-js-interop · 274 of 339

data

examples/learn/25-js-interop/data.tintin run examples/learn/25-js-interop/data.tin
import js "./shapes.mjs"

type Point = { x: float, y: float }

extern fn corners(sides: int, radius: float): Point[]   // JS returns objects; Tin checks the shape
extern fn slowUpper(s: string): string                  // an async JS function: just call it

fn main() {
  let square = corners(4, 1.0)
  print("{square.len} corners, first at ({square[0].x}, {square[0].y})")
  print(slowUpper("tin"))
}