5

Poll time/input requested. Multiple assignments in one statement: yay or nay? For a (painfully) simple example:

a = b = true;
vs.
a = true;
b = true;

Comments
  • 2
    Array or have meaningful variable name... it all depends on the scope of what you’re trying to accomplish
  • 5
    What about:

    a,b = true

    :D
  • 2
    @rui725 well in this case a and b are just placeholder names for two variables that need to be assigned the same value so an array wouldn't really come in to play. And ideally they would have meaningful names, but that is just a contrived example.
  • 1
    @Gatgeagent absolutely not.
  • 2
    @projektaquarius you can do just a=true and b= true or Maybe have a class that would hold those two variables and use set get method :) so you would have a = new Check{ value = true } and so on
  • 1
    Usually, for consistency the second style. I'm not opposed to a, b = true; but I don't use that nearly enough myself.
  • 1
Add Comment