The Startup
Published in

The Startup

How to Write a Go Function That Returns True If It Finds One Item (String, Integer, etc.) in a Slice of Items

Photo by Lukáš Vaňátko on Unsplash

A very common programming problem that arises in most languages is a simple function that returns true if an input item is present in an array (or dictionary or slice or a variety of other terms) of items and false if it is not.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tremaine Eto

Tremaine Eto

Senior Software Engineer @ Iterable | Previously worked at DIRECTV, AT&T, and Tinder | UCLA Computer Science alumni | Follow me for software engineering tips!