Hacker News new | past | comments | ask | show | jobs | submit login

Both of your examples are fine, as it is pretty clear what each method does.

In such cases, the golden rule is "if you do it more than once, create a new function". I don't know what kind of things you program if you have 100-line functions with no code sharing.




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

Search: