Anonymous user
Literals/Integer: Difference between revisions
re-order
(re-order) |
|||
Line 228:
25
37</pre>
=={{header|Metafont}}==▼
<lang metafont>num1 := oct"100";▼
num2 := hex"100";</lang>▼
Metafont numbers can't be greater than 4096, so that the maximum octal and hexadecimal legal values are <tt>7777</tt> and <tt>FFF</tt> respectively. To be honest, <tt>"100"</tt> is a string, and <tt>oct</tt> is an "internal" "''macro''"; but this is the way Metafont specifies numbers in base 8 and 16.▼
=={{header|Modula-3}}==▼
All numbers 2 to 16 are allowed to be bases.▼
<lang modula3>MODULE Literals EXPORTS Main;▼
IMPORT IO;▼
BEGIN▼
IO.PutInt(16_2D7);▼
IO.Put(" ");▼
IO.PutInt(10_727);▼
IO.Put(" ");▼
IO.PutInt(8_1327);▼
IO.Put(" ");▼
IO.PutInt(2_1011010111);▼
IO.Put("\n");▼
END Literals.</lang>▼
=={{header|Haskell}}==
Line 286 ⟶ 263:
window.alert("true");
</lang>
▲=={{header|Metafont}}==
▲<lang metafont>num1 := oct"100";
▲num2 := hex"100";</lang>
▲Metafont numbers can't be greater than 4096, so that the maximum octal and hexadecimal legal values are <tt>7777</tt> and <tt>FFF</tt> respectively. To be honest, <tt>"100"</tt> is a string, and <tt>oct</tt> is an "internal" "''macro''"; but this is the way Metafont specifies numbers in base 8 and 16.
▲=={{header|Modula-3}}==
▲All numbers 2 to 16 are allowed to be bases.
▲<lang modula3>MODULE Literals EXPORTS Main;
▲IMPORT IO;
▲BEGIN
▲ IO.PutInt(16_2D7);
▲ IO.Put(" ");
▲ IO.PutInt(10_727);
▲ IO.Put(" ");
▲ IO.PutInt(8_1327);
▲ IO.Put(" ");
▲ IO.PutInt(2_1011010111);
▲ IO.Put("\n");
▲END Literals.</lang>
=={{header|OCaml}}==
|