metaist / metaist.com

0 stars 0 forks source link

post: trying golang #16

Open metaist opened 3 months ago

metaist commented 3 months ago

Completed https://go.dev/tour/

metaist commented 3 months ago

https://go.dev/doc/code

metaist commented 3 months ago

https://go.dev/doc/effective_go

metaist commented 3 months ago

https://go.dev/doc/comment

metaist commented 3 months ago

https://gobyexample.com/worker-pools

I was surprised this syntax didn't work:

for r := range out {
    fmt.Println("Got result:", r)
}

Meaning, it ran until the out channel was out of things to do and then crashed.

metaist commented 3 months ago

Are there optional arguments? Nope and no overloading either. https://go.dev/doc/faq#overloading

metaist commented 3 months ago

Is there an equivalent of Python's range (formerly xrange)? Not really. Just use for.

metaist commented 3 months ago

Is there an equivalent of yield? No. Just use channels. https://go.dev/talks/2013/go4python.slide#20

metaist commented 3 months ago

Even cleaner: https://go.dev/talks/2013/go4python.slide#21

metaist commented 3 months ago

https://gobyexample.com/