I asked for this a while back ("drop underscore between digits as in Ada")
and the answer was no. I try to ask just once.

This was shut down without much discussion at
https://github.com/golang/go/issues/42.

I agree that it's a nice feature.

By the way, though, one nice aspect of Go is that because of how
untyped constants work you can write integers using scientific
notation:

for i := 0; i < 10e6; i++ {
        // ...
}

This is exactly the same as if you had written 10000000.

(I don't think you'd want to do this in C or Java because, although it
would "work", 10e6 is a floating point number and so i would be
converted to a double for comparison. I am not an expert in those
languages, though, so someone can correct if I'm wrong here.)

On Tue, Jun 21, 2016 at 8:44 AM, Roger Pack <rogerpack2...@gmail.com> wrote:
> I found recently when doing some language comparisons
>
> In a few other languages (ruby, java, etc.) underscores within numeric
> literals to make them more readable, ex:
>
> 10_000_000.times do
>   ...
> end
>
> go ex:
>
> for i := 0; i < 10000000; i++ {
> ...
> }
>
> I find it helps readability, and think it would be a nice addition to the
> language (or some way to group digits, perhaps there already is one?).
> Consider this a feature request (go 2.0 or what not).
> Cheers.
> -roger-
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to