> "For" loops may now range over integers
The future is now, old man!
The future is now, old man!
for i := range 10 {
What was the syntax for this before? for i := 0; i < 10; i++for i := range -10 { panic(i) }
for i := 0; i <=-10; i++{
panic
} for (size_t i = 0; i < -10; i++) {
panic
}
And it would panic 18446744073709551606 times.Man, I hope you never wondered how ERRNO behaves with CGo or that you didn't miss to update any initialization of that struct you recently added a new field to, that haunts me at 3AM.
for i := range [3:10] { for x := range iter.N(10) { ... }for i:= 3 ; i<10; i++ {}
I didn't count but it might actually be longer.
range 10 is at least shorter
for i := range [10]struct{}{} {(Back when Go came out, there were some Algol 68 comparisons, IIRC)