3 ms·
Engineer working on Hack here. You can actually write you example a bit more concisely in Hack: "$y ==> $y + 1".
by dparoski 13y ago
Engineer working on Hack here.
You can actually write you example a bit more concisely in Hack: "$y ==> $y + 1".
- iso8859-1 13y agoReturn statements are optional? So it's just the last statement in a function that'll get returned?
- dparoski 13y agoThe "return" keyword is not needed if the right hand side of the lambda arrow ("==>") is an expression that is not wrapped in curly braces. If the right hand side _is_ wrapped in curly braces then it is treated as a list of statements, in which case you do need to use the "return" keyword.
- dparoski 13y agoEdit: My previous comment was referring to the second occurrence of "return" in your example (after the "==>" arrow). Just noticed I mistakenly dropped the first occurrence of "return"; the first occurrence of "return" in your example is needed.