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

compiler: allows compound assignment operators on array

This commit is contained in:
Henrixounez
2019-08-22 03:27:57 +02:00
committed by Alexander Medvednikov
parent ffb6c6f5b4
commit 9b3b22d6b3
2 changed files with 23 additions and 1 deletions

View File

@ -199,3 +199,10 @@ fn test_clone() {
assert nums.slice(1, 3).str() == '[2, 3]'
}
fn test_doubling() {
mut nums := [1, 2, 3, 4, 5]
for i := 0; i < nums.len; i++ {
nums[i] *= 2
}
assert nums.str() == '[2, 4, 6, 8, 10]'
}