Tin

Examples · learn/10-generics · 163 of 339

task-1.solution

examples/learn/10-generics/task-1.solution.tintin run examples/learn/10-generics/task-1.solution.tin
fn repeatItem<T>(item: T, times: int): T[] {
  var out: T[] = []
  for i in 0..times {
    out.push(item)
  }
  out
}

fn main() {
  print(repeatItem("hi", 3))
  print(repeatItem(0, 4))
}