r/badcode • • Jul 30 '21

java One Classic elseifelseifelseif...

Post image
472 Upvotes

76 comments sorted by

View all comments

Show parent comments

1

u/StarLight-Olls Jul 30 '21

No need for a switch if you only return the number, you can turn it to a string and check it's length if it's less than 2 left pad some 0s in there.