Function Iterators might just change the way we write loops in Go

Published: 15 April 2024
on channel: Dreams of Code
57,639
2.2k

The rangefunc experimental feature is now available with Go 1.22.

Over the last couple of weeks I have been playing with this new feature to see how far I can push it, and I think it may just change the way we write some loops in Go.

Sign up for my Golang course at: https://dreamsofcode.io/courses/comma...
(Website is written in Go, btw)

Video links:
RangeFunc wiki: https://go.dev/wiki/RangefuncExperiment
Loop package: https://github.com/dreamsofcode-io/loop


Join this channel to get access to perks:
   / @dreamsofcode  

Join Discord:   / discord  
Join Twitter:   / dreamsofcode_io  

00:00:00 Intro
00:00:23 rangefunc
00:01:55 Parallel iteration in Go
00:03:46 Convert to Parallel Iterator
00:05:57 Handling Break
00:07:47 Making Generic
00:08:28 Footguns
00:09:08 iter package
00:10:01 Loop package
00:10:38 Conclusion
00:10:59 Good news!


Watch video Function Iterators might just change the way we write loops in Go online without registration, duration hours minute second in high quality. This video was added by user Dreams of Code 15 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 57,639 once and liked it 2.2 thousand people.