Next: Cannot use illegal
in if
-statement, Previous: Cannot use otherwise
guard with non-guard statements, Up: Well-formedness – Mixing [Contents][Index]
illegal
with imperative statementsAn illegal
statement must occur on its own; no other
action
s or assign
s are allowed. That also applies if the
illegal
occurs in a nested compound
:
interface imperative_illegal { in void hello (); behavior { bool b = false; on hello: { b = true; illegal; } } }
This results in the following error message:
imperative-illegal.dzn:10:7: error: cannot use illegal with imperative statements imperative-illegal.dzn:9:7: info: imperative statement here
In a component, using an illegal
within a conditional statement
is allowed. Also the condition may be accompanied by other
action
s, e.g:
interface ihello { in void hello(); behavior { on hello: {} } } component component_if_illegal { provides ihello p; behavior { bool b = true; on p.hello(): { b = false; if (b) illegal; } } }