Coding in Julia shows that using underscore as integer digit separator works in Julia.
x = 1_000_000
and
x = 1000000
are basically the same thing.
However, I am not able to locate the documentation for this, to read more details. Could anyone point me to that.
Also is digit separation character a common thing in different languages? What are the separator character in C++, java, and Python?
The standards proposal document for C++14 has a very lengthy discussion on the rationale and possible choices for a digit separator. The considered `
, '
, _
, ::
, and (space). Some of the discussion cites other languages. According to the document,
_
is also used in Ada, VHDL, Verilog, and possibly Algol68. Underscores also appear to be used in Java 7 (StackOverflow question, proposal). C++ settled on '
as their separator.
Julia hasn't formally documented underscore-separated numeric literals yet, but you can find some information in this GitHub issue (#848) and this julia-dev thread.
It doesn't look like Python has a numeric literal separator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With