Hi,
Does Painless support immediately-invoked function expressions (IIFEs)? For reasons (I'd prefer not to explain them) I need to return the result of several expressions to an if-statement, as shown in an example below.
if ( (function () { def x = false; return !x; })() ) {
// -- do something.
}
I haven't found a way to get IIFE's working in Painless, are they supported?
Just to clarify, I can't write
boolean someFn () {
def x = false;
return !x;
}
def condition = someFn();
if (condition) {
// -- do something
}
in this case, I need to use an IIFE.
Thanks for reading,