0
    require
        valid_item: attached item as l_i and then l_i.valid_for_insert or l_i.valid_for_update

why do I have an unknown identifier here with l_i??!!!

Pipo
  • 4,653
  • 38
  • 47

1 Answers1

3

Try with

valid_item: attached item as l_i and then (l_i.valid_for_insert or l_i.valid_for_update)

Note you can also do

item_set: attached item as l_i 
valid_item: l_i.valid_for_insert or l_i.valid_for_update

you can reuse the object test local variable l_i from a previous precondition.

Jocelyn
  • 693
  • 5
  • 8
  • Very nice answer! could you explain me why? what is the priority of evaluation without parenthesis? – Pipo Oct 12 '18 at 17:07
  • 1
    `a and then b or c ` is `(a and then b) or c` - `and`, `and then` behave the same. `and then` is used when you want to be sure the "right" operand is evaluated only if the "left" one is True. It is also used for Void-safety, as usually the right operand must be applied on non Void object. – Jocelyn Oct 17 '18 at 15:01