a_fan
a_fan

Reputation: 387

Equivalence of if-then and implies in OCL statements

Are the following two OCL statements equivalent for some function context?

post: if a > 0 then b < c

post: b < c implies a > 0

Upvotes: 3

Views: 674

Answers (1)

Ed Willink
Ed Willink

Reputation: 1498

No.

In OCL, the construct is if ... then ... else ... endif so your first example can only be 'equivalent' to a different syntax error.

The logical operations are rewritable using if constructs, but considerable care is necessary to ensure that the possibilities with null or invalid inputs do not crash the if condition term which must be a 2-valued Boolean.

Upvotes: 2

Related Questions