v icon indicating copy to clipboard operation
v copied to clipboard

runtime panic error when using string const

Open ghost opened this issue 7 years ago • 3 comments

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)

ghost avatar Jun 16 '19 07:06 ghost

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.

medvednikov avatar Jun 16 '19 11:06 medvednikov

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

joe-conigliaro avatar Jun 17 '19 03:06 joe-conigliaro

This is known and being worked on.

Bowero avatar Jun 26 '19 19:06 Bowero