1

Basically, I just want to know if a bool[5] array will hold exactly 5 booleans, or can it hold less than 5 booleans as well?

1 Answer 1

1

I guess this depends on what you mean with "holding".

If you create array of type bool with static size of 5, it means you will immediately have an array of types bool with 5 entries, and all entries have the value false. So in a sense the array is already "filled".

There is no concept of "null" or empty in Solidity. All types have a default value which is used. For booleans, this is "false". For all integer types, this is "0".

So your array will always contain exactly 5 entries. If you don't set them to anything, they will be false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.