Define a primitive data type: Difference between revisions
m
→{{header|Sidef}}: make the range inclusive
imported>Arakov |
m (→{{header|Sidef}}: make the range inclusive) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 659:
=={{header|Elena}}==
ELENA
<syntaxhighlight lang="elena">import extensions;
Line 717:
console.printLine("4t = ", i);
console.printLine("8t = ", j);
console.
try
Line 732:
4t = 4
8t = 8
4t + 8t = A value is out of range
</pre>
Line 2,407 ⟶ 2,406:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">subset Integer < Number { .is_int }
subset MyIntLimit < Integer { . ~~ (1 ..
class MyInt(value < MyIntLimit) {
Line 2,999 ⟶ 2,998:
The following carries out this procedure for a few basic operations and shows examples of their usage including throwing an out of bounds error on the last one.
<syntaxhighlight lang="
construct new(n) {
if (!(n is Num && n.isInteger && n >= 1 && n <= 10)) {
|