Define a primitive data type: Difference between revisions

Content added Content deleted
(Frink)
Line 988: Line 988:


=={{header|Frink}}==
=={{header|Frink}}==
Frink can set "constraints" on variables that must be enforced at all times. One way is to define a function that returns <CODE>true</CODE> if the constraint is met. This constraint is checked whenever assigning a new value to the variable.
<lang frink>oneToTen[x] := isInteger[x] AND x >= 1 AND x <= 10
<lang frink>oneToTen[x] := isInteger[x] AND x >= 1 AND x <= 10