1×
Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account
Autoplay

    Filter an Array in Go

    goGo

    Golang has no built-in function(s) to filter an array. This lesson will teach you two different ways to filter.

    The first is to create a separate array and add the filtered elements to it. This works great, but doesn't use memory as efficiently as the second way.

    The second way shows you how to filter by altering the original array in place without making another array to hold the filtered elements. But, it has a side-effect that I'll tell you about which may help you decide which approach you will use to filter your array.