DEV Community

Discussion on: Have blocks return the last statement with the Comma Operator

Collapse
 
joelnet profile image
JavaScript Joel

I use the comma operator often in functional projects for this exact reason and I find it more intuitive than having a return statement.

One reason is that it mimics the pipe operator that I am frequently using, so the code blocks look similar.

Also every function flows through from top to bottom and always returning the last value, so in this codebase it becomes very intuitive.

Collapse
 
nektro profile image
Meghan (she/her)

Nice! Speaking of the pipe operator, have you seen github.com/tc39/proposal-pipeline-...

Collapse
 
joelnet profile image
JavaScript Joel

Yes and I am very excited for it. Also excited for the partial application proposal. I think the pipeline proposal would replace compose and pipe and the partial application proposal would replace the need for most currying.

Very excited!