r/ProgrammerHumor • • 12d ago

Meme cppythRusGoSharp

Post image
308 Upvotes

36 comments sorted by

View all comments

Show parent comment

3

u/redlaWw 12d ago

It used to be that you could just do for int i = 1..5, but old ranges were inefficient and confusing due to the fact that they were iterators themselves, rather than having a separate iterator type. In order to resolve this, a new range type was introduced, and a traditional range can be converted into a new range using the newly-introduced range keyword. Using old ranges for anything except constructing a new range has been deprecated, but they remain in the language for backwards-compatibility reasons.