Tin

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

task-1.solution

examples/learn/25-js-interop/task-1.solution.tintin run examples/learn/25-js-interop/task-1.solution.tin
import js "node:os" {
  extern fn platform(): string
  extern fn cpus(): Cpu[]
}

type Cpu = { model: string }

fn main() {
  let n = cpus().len
  print(if n > 0 { "this machine has CPUs" } else { "no CPUs?" })
  print(platform().len > 0)
}