From b5507a9b82a251766fddb8c6ec08bebfd8e922bb Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 23:04:18 +0000 Subject: [PATCH] [Sync Iteration] go/resistor-color/1 --- .../go/resistor-color/1/resistor_color.go | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 solutions/go/resistor-color/1/resistor_color.go diff --git a/solutions/go/resistor-color/1/resistor_color.go b/solutions/go/resistor-color/1/resistor_color.go new file mode 100644 index 0000000..1c32985 --- /dev/null +++ b/solutions/go/resistor-color/1/resistor_color.go @@ -0,0 +1,28 @@ +package resistorcolor + +// Colors returns the list of all colors. +var Size = 10 +func Colors() []string { + return []string{ + "black", + "brown", + "red", + "orange", + "yellow", + "green", + "blue", + "violet", + "grey", + "white", + } +} + +// ColorCode returns the resistance value of the given color. +func ColorCode(color string) int { + for i := 0; i < Size; i++ { + if Colors()[i] == color { + return i + } + } + return -1 +}