V Forum

[ log in ]

Syntax error: What am I doing wrong?

kpeters58 Dec 24 19:19
//
// V tests
//

struct User {
name string
age int
}

fn main {

u := User { // -> 'syntax error: Unexpected '{', expected '('
name: 'Cohen'
age: 13
}


mut can_register := ${u.age > 13}
println(can_register)

}
acidorus Dec 25 13:09
hi
main to
main()

mut can_register := ${u.age > 13} to
can_register := '${u.age > 13}'
kpeters58 Dec 25 17:12
Ah, I see - thanks. So the error line isn't correct - it should have pointed one line higher...
acidorus Dec 25 17:28

Yes, the Bug is displayed on the line; the error (line -1) would be the correct one.



Powered by Vorum, open-source blogging/forum software written in V