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:

committed by
Alexander Medvednikov

parent
ffb6c6f5b4
commit
9b3b22d6b3
@ -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]'
|
||||
}
|
Reference in New Issue
Block a user