Define a primitive data type: Difference between revisions

(→‎{{header|Pascal}}: add example)
Line 830:
%** procedure 'IntPow' in file "/Users/raph/devel/mozdss-branch/mozart/share/lib/base/Number.oz", line 32, column 3, PC = 16461488
%**--------------------------------------------------------------
</pre>
 
=={{header|Pascal}}==
{{works with|Free_Pascal}}
The details of range checks are compiler specific. With Freepascal range checks can also be enabled on the command line with the -Cr option.
<lang pascal>Program BoundInteger(output);
 
{$RANGECHECKS ON}
 
type
TPartialInteger = 1..10;
 
var
testvar: TPartialInteger;
i: integer;
 
begin
for i := 1 to 11 do
begin
writeln(i);
testvar := i;
end;
end.</lang>
Output:
<pre>% ./BoundInteger
1
2
3
4
5
6
7
8
9
10
11
Runtime error 201 at $000113A6
$000113A6
$0002F586
$00011309
$00011238
$00000001
</pre>
 
Line 854 ⟶ 896:
$t = 'xyzzy';
# dies, too small. string is 0 interpreted numerically</lang>
 
=={{header|Perl 6}}==
 
Anonymous user