mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
9 lines
189 B
Swift
9 lines
189 B
Swift
func repeat<ItemType>(item: ItemType, times: Int) -> ItemType[] {
|
|
var result = ItemType[]()
|
|
for i in 0..times {
|
|
result += item
|
|
}
|
|
return result
|
|
}
|
|
repeat("knock", 4)
|