Numeric separator syntax: Difference between revisions
Content added Content deleted
(→{{header|FreeBASIC}}: Completing the entry.) |
m (→{{header|Phix}}: syntax coloured) |
||
Line 356: | Line 356: | ||
Phix simply ignores underscores in numeric literals, however a leading underscore signifies a normal identifier, much like a123 or tmp2.<br> |
Phix simply ignores underscores in numeric literals, however a leading underscore signifies a normal identifier, much like a123 or tmp2.<br> |
||
Commas are not allowed in numeric literals, since they delimit sequence elements, routine parameters, and such like, for example {1,2,3,4}. |
Commas are not allowed in numeric literals, since they delimit sequence elements, routine parameters, and such like, for example {1,2,3,4}. |
||
<lang Phix> |
<!--<lang Phix>(phixonline)--> |
||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
|||
⚫ | |||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">1_2_3</span> <span style="color: #000080;font-style:italic;">-- 123 |
|||
? 0b1_0_1_0_1 -- 21 |
|||
⚫ | |||
? 0b_1_0_1_0_1 -- 21 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">0b1_0_1_0_1</span> <span style="color: #000080;font-style:italic;">-- 21</span> |
|||
? 0xa_bc_d -- 43981 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">0b_1_0_1_0_1</span> <span style="color: #000080;font-style:italic;">-- 21</span> |
|||
? #_DEAD_BEEF_ -- 3735928559.0 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">0xa_bc_d</span> <span style="color: #000080;font-style:italic;">-- 43981</span> |
|||
? 0x_dead_beef -- 3735928559.0 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">#_DEAD_BEEF_</span> <span style="color: #000080;font-style:italic;">-- 3735928559.0</span> |
|||
? 3.14_15_93 -- 3.141593 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">0x_dead_beef</span> <span style="color: #000080;font-style:italic;">-- 3735928559.0</span> |
|||
? 1_2_3_4.2_5 -- 1234.25 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">3.14_15_93</span> <span style="color: #000080;font-style:italic;">-- 3.141593</span> |
|||
? 1234_.25 -- 1234.25 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">1_2_3_4.2_5</span> <span style="color: #000080;font-style:italic;">-- 1234.25</span> |
|||
? 1234._25 -- 1234.25 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">1234_.25</span> <span style="color: #000080;font-style:italic;">-- 1234.25</span> |
|||
? 1234.25_ -- 1234.25 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">1234._25</span> <span style="color: #000080;font-style:italic;">-- 1234.25</span> |
|||
? 12__34.25 -- 1234.25 |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">1234.25_</span> <span style="color: #000080;font-style:italic;">-- 1234.25</span> |
|||
? 6.0_22e4 -- 60220</lang> |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">12__34.25</span> <span style="color: #000080;font-style:italic;">-- 1234.25</span> |
|||
<span style="color: #0000FF;">?</span> <span style="color: #000000;">6.0_22e4</span> <span style="color: #000080;font-style:italic;">-- 60220</span> |
|||
<!--</lang>--> |
|||
=={{header|Python}}== |
=={{header|Python}}== |