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

compiler: adds handling of two variables for loop on string

This commit is contained in:
Henrixounez
2019-08-29 18:46:03 +02:00
committed by Alexander Medvednikov
parent 519028e263
commit 29e0396eca
2 changed files with 32 additions and 2 deletions

View File

@ -400,3 +400,21 @@ fn test_title() {
s.to_lower()
assert s.title() == 'Hello World'
}
fn test_for_loop() {
mut i := 0
s := 'abcd'
for c in s {
assert c == s[i]
i++
}
}
fn test_for_loop_two() {
s := 'abcd'
for i, c in s {
assert c == s[i]
}
}