mattn / anko

Scriptable interpreter written in golang
http://play-anko.appspot.com/
MIT License
1.45k stars 120 forks source link

How to check if a channel is closed? #353

Closed brutella closed 1 year ago

brutella commented 1 year ago

In Go, I can check if a channel is closed by doing this.

ch := make(chan bool)
close(ch)
v, ok := <- ch
if !ok { // channel is closed
}

When I do a similar think in anko, I get an error: undefined symbol 'v'.

ch = make(chan bool)
close(ch)
v, ok = <- ch // error: undefined symbol 'v'

Is there a way to check if a channel is closed in anko?

brutella commented 1 year ago

Sorry, this works as expected.