Smart Contract
ArrayUtils
A.1e4aa0b87d10b141.ArrayUtils
1// Copied from https://github.com/green-goo-dao/flow-utils/blob/crescendo/contracts/ArrayUtils.cdc
2// Special thanks to the Green Goo Dao contributors for creating this contract
3access(all) contract ArrayUtils {
4 access(all) fun rangeFunc(_ start: Int, _ end: Int, _ f: fun (Int): Void) {
5 var current = start
6 while current < end {
7 f(current)
8 current = current + 1
9 }
10 }
11
12 access(all) fun range(_ start: Int, _ end: Int): [Int] {
13 var res: [Int] = []
14 self.rangeFunc(start, end, fun (i: Int) {
15 res.append(i)
16 })
17 return res
18 }
19}
20