Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Then declare the array with 13 slots, fill slots 1-12 with the appropriate strings, and don't use slot 0. Or better, put in an error check for being passed a zero.

Suddenly, a 1-12 value for "month" is directly an index into an array to convert the number into a string...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: