My Solidity linter warns me if I have more than 15 variables declared, and I got around this by packing multivariable into an array, such as changing

unit public x1;
unit public x2;


unit[2] public x;

I noticed the array uses a couple thousand less gas on initial creation (trivial), but after that, no difference when reading or writing.

It seems there is no explicit constraint on variables declared though there was at some earlier time. Is this true, and so for clarity I should separate out variables rather than pack them in to arrays?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.