Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added documentation of early returns #457

Merged
merged 1 commit into from Jul 27, 2017

Conversation

sjsf
Copy link
Contributor

@sjsf sjsf commented Jul 26, 2017

Signed-off-by: Simon Kaufmann simon.kfm@googlemail.com

@@ -207,6 +207,19 @@ Besides the implicitly available variables for items and commands/states, rules
- Every rule that has at least one command event trigger, will have the variable `receivedCommand` available, which can be used inside the execution block.
- Every rule that has at least one status change event trigger, will have the variable `previousState` available, which can be used inside the execution block.

### Early returns

Similar to Java, it is possible to return early from a rule, not executing the rest of the statements like this:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "Similar to Java" ?

sendCommand(Heating, ON)
```

Caveat: Please note the semicolon after the return statement. If you leave it out, the next line might still get executed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"might" doesn't create confidence in a determined openHAB behavior. In my opinion just leave it with the first sentence or add something as a short rationale like "which terminates the command without an additional argument." wdyt?

Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@sjsf
Copy link
Contributor Author

sjsf commented Jul 27, 2017

Thanks for your feedback! I have updated the PR.

@ThomDietrich
Copy link
Member

Thanks!

@ThomDietrich ThomDietrich merged commit b061e1d into openhab:gh-pages Jul 27, 2017
@Confectrician Confectrician added this to the 2.x.x milestone Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants