dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit c3ba800fd12a6cbbd5f31ab2dcff08b65b3d9a91
parent 5a8b9329bd1669160a67f058dfdd22948b0a8c6f
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 17 Nov 2022 12:48:06 -0500

simplify code

Diffstat:
Mcmd/art/main.go | 9+++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/cmd/art/main.go b/cmd/art/main.go @@ -137,21 +137,18 @@ func getClassName(idx int) string { const firstRune = 'a' const lastRune = 'z' out := []rune{firstRune} +OUT_LOOP: for i := idx; i > 0; i-- { // If first letter reached "z", increment the next one which is not yet at "z" // If we did not find a suitable letter to increment, let's add a new one in the array, and reset all to "a". - found := false for i := range out { if out[i] < lastRune { - found = true out[i]++ - break + continue OUT_LOOP } out[i] = firstRune } - if !found { - out = append(out, firstRune) - } + out = append(out, firstRune) } // Reverse slice for i, j := 0, len(out)-1; i < j; i, j = i+1, j-1 {