1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

arrays.range(min, max)

This commit is contained in:
Alexander Medvednikov
2019-10-30 16:21:57 +03:00
parent 96f7620628
commit aa39451c8b
3 changed files with 23 additions and 2 deletions

10
vlib/arrays/arrays.v Normal file
View File

@ -0,0 +1,10 @@
module arrays
fn range<T>(start, end T) []T {
mut res := [T(0)]
for i := start; i < end; i++ {
res << i
}
return res
}

10
vlib/arrays/arrays_test.v Normal file
View File

@ -0,0 +1,10 @@
import arrays
fn test_range() {
/*
TODO
a := arrays.range(1, 10)
assert a[0] == 1
println(a)
*/
}