Creating a new variable versus assigning an existing one
- by rwallace
Which is more common, creating a new variable versus assigning an existing variable (field, array element etc - anything that syntactically uses the assignment operator)?
The reason I ask is that I'm designing a new language, and wondering which of these two operations should get the shorter syntax. It's not intended to be a pure functional language, or the question wouldn't arise, so I'd ideally like to count usage across large existing code bases in procedural and object-oriented languages like C, C++ and Java, though as far as I can see there isn't an easy way to do this automatically, and going by memory and eyeball, neither is obviously more common than the other.