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

Does 'each' serve as both forEach and map? It appears that way from the fib example.


Yes. The compiler detects whether the return value is used or not to determine whether to accumulate the results in an array or not. Also, unlike forEach and map you can use continue or break.




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

Search: