V Forum

[ log in ]

Enum

kirk-friend 2019-12-16 01:02
Are enum available in V 0.1.23 1cd5fab ? The example on the docs page doesn't work.
medvednikov 2019-12-16 01:46
Yes, enum has been available from the start. What error are you getting?
kirk-friend 2019-12-16 08:38
Can you run the example on the documentation page? I get an unexpected token


unexpected token: `}`
6| color = .green

Here is the example:

fn main() {
enum Color {
red green blue}

mut color := Color.red
color = .green
println(color)
}
kirk-friend 2019-12-16 11:36
Looks like enums can only be defined outside of main.
medvednikov 2019-12-16 16:47
Indeed, I'll fix the examples today.

Thanks for reporting it.
kirk-friend 2019-12-17 10:25
Hi Alex,

Thanks for updating the example but the code in the playground is still incorrect when using the run button.

Cheers.
medvednikov 2019-12-17 16:26
Fixed.



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