v-community / v_by_example

Learn V by Example

Home Page:https://v-community.gitbook.io/v-by-example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

insert function for array

Ivo-Balbaert opened this issue · comments

arrays/functions.md:

The example

mut names := ['Samuel', 'John', 'Peter']
    names.insert(2, 'Tom')
    println(names)

should (temporarily) be removed because it gives an error both on Windows and Linux
// names.insert(2, 'Tom') // Nov 16: error in Windows and Linux
(see mut_arrays.v)
/tmp/v/main.tmp.c: In function ‘main__main’:
/tmp/v/main.tmp.c:3277:38: error: lvalue required as unary ‘&’ operand
array_insert (& /* ? */ names , 2 ,& /112 e="void" g="string" */ tos3("Tom") ) ...
(Use v -g to print the entire error message)
V error: C error. This should never happen.

If ok, I can do a pull request for this issue.