Numeric separator syntax: Difference between revisions

Added XPL0 example.
(Added C implementation)
(Added XPL0 example.)
Line 400:
say 12__34.25; # 1234.25
# say _1234.25; # syntax error</lang>
 
=={{header|XPL0}}==
Numbers can contain underlines, which is useful for making long strings
of digits easier to recognize. Underlines in coded constants are simply
ignored by the parser. Underlines in numbers typed in to a running
program are also ignored.
 
<lang XPL0>def Meg = 1_000_000;
[IntOut(0, Meg); CrLf(0);
RlOut(0, 123__45.67_89_); CrLf(0);
HexOut(0, $ABCD_EF01); CrLf(0);
HexOut(0, %1010_1011_1100_1101_1110_1111_0000_0001); CrLf(0);
IntOut(0, IntIn(0));
]</lang>
 
{{out}}
<pre>
1000000
12345.67890
ABCDEF01
ABCDEF01
-321_00__0_
-321000
</pre>
 
=={{header|zkl}}==
772

edits