For Practice-It question 2.13 firstSecond2
, the "simpler solution" the question asks for assigns two variables of identical types on the same line.
Given:
int first = 8;
int second = 19;
first = first + second;
second = first - second;
first = first - second;
The first line of the answer field shortened code
is
int first = 8, second = 19
which I have never seen before. Knowing this, is assigning multiple variables of the same type on the same line good practice? It seems like this would cause some confusion and wouldn't be an ideal solution.