v
v copied to clipboard
runtime panic error when using string const
In Playground version 0.0.10, following const example program panics and shows
3.140000 V panic: println(NIL)
program:
const (
PI = 3.14
WORLD = '世界'
)
println(PI)
println(WORLD)
This is again caused by the unstable "no fn main" feature.
This works fine:
const (
PI = 3.14
WORLD = '世界'
)
fn main() {
println(PI)
println(WORLD)
}
Will fix asap.
Personally I don't think that's a necessary feature anyway, Since it's not that hard to have a main function, and variables outside of main look kind of like they would be in some global scope also. Cant wait for it to be open sourced :P
This is known and being worked on.