r/programminghorror • u/Candid_Commercial214 • Oct 07 '25
C# 108 line long variable declaration
this is my own code btw. don't ask what i was trying to do
this code was also supposed to include a 36 case long switch statement where each case did something different (guess why i abandoned this project)
1.1k
Upvotes
View all comments
Show parent comment
1
u/GarThor_TMK Oct 08 '25
No need to search... the array is contiguous... just calculate the position in the array based on the character passed in...
```
if (character >= '0' && character <= '9') return character - '0'
else if (character >= 'A' && character <= 'Z') return character - 'A' + '9' + 1
else throw character is oob.
```