V: "GOT ARR" printed when using "<-" instead of "in"

Created on 1 Apr 2020  路  4Comments  路  Source: vlang/v

V version: V 0.1.25 5b99007
OS:
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.18363 N/A Build 18363

What did you do?

fn main() {
    for val <- [1, 2, 3, 4] {
        println(val)
    }
}

What did you expect to see?

1
2
3
4

What did you see instead?

GOT ARR
1
2
3
4
Bug

All 4 comments

https://github.com/vlang/v/blob/master/vlib/compiler/scanner.v#L687
Faulty uncommented println.

Though, should this syntax be even allowed?

Interesting. I even didn't know the existence of <- in V before seeing this.

This was an experimental syntax. Will be removed today. :)

Done.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jtkirkpatrick picture jtkirkpatrick  路  3Comments

penguindark picture penguindark  路  3Comments

clpo13 picture clpo13  路  3Comments

lobotony picture lobotony  路  3Comments

radare picture radare  路  3Comments