1. 5
    Filter an Array in Go
    7m 2s

Filter an Array in Go

Jeff Roberts
InstructorJeff Roberts

Share this video with your friends

Send Tweet

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.