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 46.x:
<syntaxhighlight lang="elena">import extensions;
Line 717:
console.printLine("4t = ", i);
console.printLine("8t = ", j);
console.writeLinewrite("4t + 8t = ");
 
try
Line 732:
4t = 4
8t = 8
4t + 8t = A value is out of range
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 ..^ 10) }
 
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="ecmascriptwren">class TinyInt {
construct new(n) {
if (!(n is Num && n.isInteger && n >= 1 && n <= 10)) {
2,747

edits