I suggest you ...

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.

2 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Joshua DeLongJoshua DeLong shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • QwertieQwertie commented  ·   ·  Flag as inappropriate

        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.

      Feedback and Knowledge Base