How to set the elements of an array of defined type in one line?

Thank you very much!
Indeed, I was thinking of some more generic/native solutions such as just using for _ in 1:2 as you suggested, something similar with the link below,