Message from JavaScript discussions

November 2017

— But then, what about a different if syntax that works kind of like a switch...
We have this:

if (thing === x || thing === y)


but what about:
sif(thing, x, y, onX => dostuff, onY => doStuff);

Message permanent page

— 

sif is something we can make ourselves but it's eh as well... what if we had a syntax that made it easy:
``sif (thing; x; y;) { ...

— Idk, something like that

— Where strict comparisons etc are implicit

— Or maybe

sif (thing) is (x) { ... } is (y) { ... }

— Ramda has this, kindof

— I was wondering if it did haha

— 

R.ifElse([
[ predicate, callback ],
[ predicate, callback ]
])

— Something like that

— Interesting

— I have become a ramda evangelist

— So there's the problem of switch but also the problem of running a block if a value equals one of many things

Message permanent page