Can I use 'return' in rules?

Can I use “return” (or exit) in rule? I have many condition that finish rule execution , it simplify my rules but I’ve read somewhere that is not safe use retun in rules.

for example

rule "RFID_operation_porch"
	when 
		Item Porch_RFIDTag 	 received update 
	then
	
	// sprawdzam czy nie trwa juz operacja odczytu 
	if ( porchRFIDLock == false ) {
		...something...
	}
	else  {
		return   // exit from a rule
	}
	
	...next action...

Yes you can. This answer is also in the docs: http://docs.openhab.org/configuration/rules-dsl.html#return

1 Like