Is is possible to end the lambda before the last statement?
Very easy example:
val Functions$Function1<GenericItem, Boolean> log00= [ s |
logInfo("lambda 00:", s.name + ": " + s.state.toString)
logInfo("lambda 01:", s.name + ": " + s.state.toString)
true
]
Is it possible to end before the 2nd logInfo line? Something line:
val Functions$Function1<GenericItem, Boolean> log00= [ s |
logInfo("lambda 00:", s.name + ": " + s.state.toString)
if(s.state.toString == "OFF")
return;
logInfo("lambda 01:", s.name + ": " + s.state.toString)
true
]
rlkoshak
(Rich Koshak)
2
You can try to use the return; but in my experience using break, that might exit the whole rule, not just the lambda.
Try it and see. If that doesn’t work, you will need to structure the lambda with if else statements.
NOTE: If you don’t care about the return value, you can use a Procedure:
val Procedures$Procedure1<GenericItem> log00 = [ s |
logInfo("lambda 00:", s.name + ": " + s.state.toString)
if(s.state.toString == "OFF")
return;
logInfo("lambda 01:", s.name + ": " + s.state.toString
]
@rlkoshak
I can verify, it is working. There is a little typo, can you correct it?
val Procedures$Procedure1<GenericItem> log00 = [ s |
'- ’ should be ‘=’