odin-lang / odin-lang.org

http://odin-lang.org
26 stars 80 forks source link

document range operation for array initialization #230

Closed eightfilms closed 1 week ago

eightfilms commented 1 month ago

Found this neat trick on discord but it isn't in the docs, thought it might be useful - feel free to close otherwise

Yep. [?]int{0..<16 = 123} But note that if you want a slice, you'll probably need to do an explicit copy, or slice.fill

https://discord.com/channels/568138951836172421/568871298428698645/1269783875459088436