Generics Example in Go - MinMax

Generics is awesome! Why not have a try an example

Jerry An
Level Up Coding
Published in
2 min readApr 14, 2022

--

Generic programming enables the representation of functions and data structures in a generic form, with types factored out.

What does this mean?

This post uses an example to show why and how to use generics in Go.

Min-Max Problem

Given a series of values whose types are all integer (float or string), return the minimum/maximum value.

--

--