Blockly - return block for rule condition

Hi,

OH3.2.0

when creating a rule I can use Blockly to execute a script as rule action, but I can also use Blockly to execute a script as rule condition.

As rule condition the script needs to return true or false, but I have not find any “return” block so far.
Am I missing something or is this worth to also consider for next release?

Thanks,
Matthias

It’s not return a boolean, the last line of the script needs to evaluate to a boolean.

In code, instead of

if(x < 5) return true
else return false

or something like that, you’d have

x < 5

You should be able to do that in Blockly now I think.

Thanks, that’s super helpful.

So you simply used as last block this one?

grafik

Without connecting it to any other block.

Yes

1 Like