Ability to assign multiple variables in declaration statement
I'd like the ability to assign multiple variables in the declaration as below. Currently it requires the code to be two lines but it could be simplified more into a single line.
Current:
int item1, item2, item3, item4, item5;
item1 = item2 = item3 = item4 = item5 = 99;
Seems useless to type all the variables over again in this instance. Now the proposed way.
int item1, item2, item3, item4, item5 = 99;
Now 99 would be assigned to all 5 item variables as in the current code.
1 comment
-
Qwertie
commented
It's not every day that you assign the same number to five different variables. It's not so hard to type
int item1=99, item2=99, item3=99, item4=99, item5=99;
in fact, I did it just now, and it took less effort than writing the rest of this message.