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:

committed by
Alexander Medvednikov

parent
519028e263
commit
29e0396eca
@ -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]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user