Running:
fn main() {
mut types := ['game', 'web', 'tools', 'GUI']
println(types + ['whoot', 'xyz'])
}
produces You just found a bug. V can't compile this program, but it should. Please create a GitHub issue.
I expect to add the items together in the array.
types.append_array([...]) should do what you want.
+ doesn't work with arrays.
Gotcha, then maybe adjust the compiler to not throw this error in this case, that's the only reason i opened this thread :)
Also, append_array does not look like the best name, merge_with sounds much better and it's more intuitive.
merge_with is less intuitive IMHO because it implies that it's actually _merging_ the arrays (i.e. as in merge sort).
Perhaps join, if a shorter name is required.
Fixed:
operator + not defined on `[]string`
Most helpful comment
merge_withis less intuitive IMHO because it implies that it's actually _merging_ the arrays (i.e. as in merge sort).Perhaps
join, if a shorter name is required.