Examples · learn/10-generics · 163 of 339
task-1.solution
tin run examples/learn/10-generics/task-1.solution.tinfn 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))
}